2
0
mirror of https://github.com/GNOME/libxml2.git synced 2025-03-19 18:50:25 +08:00

CORBA defines fixes, char encoding atodetection, Daniel

This commit is contained in:
Daniel Veillard 1999-05-29 11:51:49 +00:00
parent 5e60f5a236
commit 27d88744f9
12 changed files with 664 additions and 311 deletions

@ -1,10 +1,14 @@
Sat May 29 13:34:42 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.[ch]: unified the XML_NO_CORBA defines.
* parser.c encoding.[ch]: started plugging in char encoding detection
Fri May 28 22:58:42 EDT 1999 Manish Vachharajani <mvachhar@vger.rutgers.edu>
* tree.c: (xmlSaveFile) - removed double call of xmlContentDump.
Also freed allocated buffer.
Wed Apr 21 22:07:35 CEST 1999
Wed Apr 21 22:07:35 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* parser.[ch] tree.[ch] entities.[ch] valid.[ch] : removed the main
reentrancy problem at printing. One is left in entities.c, to
remove ASAP

93
SAX.c

@ -26,8 +26,9 @@
* Returns a CHAR *
*/
const CHAR *
getPublicId(xmlParserCtxtPtr ctxt)
getPublicId(void *ctx)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
return(NULL);
}
@ -41,8 +42,9 @@ getPublicId(xmlParserCtxtPtr ctxt)
* Returns a CHAR *
*/
const CHAR *
getSystemId(xmlParserCtxtPtr ctxt)
getSystemId(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->input->filename);
}
@ -55,8 +57,9 @@ getSystemId(xmlParserCtxtPtr ctxt)
* Returns an int
*/
int
getLineNumber(xmlParserCtxtPtr ctxt)
getLineNumber(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->input->line);
}
@ -69,8 +72,9 @@ getLineNumber(xmlParserCtxtPtr ctxt)
* Returns an int
*/
int
getColumnNumber(xmlParserCtxtPtr ctxt)
getColumnNumber(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->input->col);
}
@ -91,8 +95,9 @@ xmlSAXLocator xmlDefaultSAXLocator = {
* Returns 1 if true
*/
int
isStandalone(xmlParserCtxtPtr ctxt)
isStandalone(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->myDoc->standalone == 1);
}
@ -105,8 +110,9 @@ isStandalone(xmlParserCtxtPtr ctxt)
* Returns 1 if true
*/
int
hasInternalSubset(xmlParserCtxtPtr ctxt)
hasInternalSubset(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->myDoc->intSubset != NULL);
}
@ -119,8 +125,9 @@ hasInternalSubset(xmlParserCtxtPtr ctxt)
* Returns 1 if true
*/
int
hasExternalSubset(xmlParserCtxtPtr ctxt)
hasExternalSubset(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
return(ctxt->myDoc->extSubset != NULL);
}
@ -131,9 +138,10 @@ hasExternalSubset(xmlParserCtxtPtr ctxt)
* Does this document has an internal subset
*/
void
internalSubset(xmlParserCtxtPtr ctxt, const CHAR *name,
internalSubset(void *ctx, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.internalSubset(%s, %s, %s)\n",
name, ExternalID, SystemID);
@ -156,8 +164,9 @@ internalSubset(xmlParserCtxtPtr ctxt, const CHAR *name,
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
xmlParserInputPtr
resolveEntity(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *systemId)
resolveEntity(void *ctx, const CHAR *publicId, const CHAR *systemId)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n", publicId, systemId);
@ -179,8 +188,9 @@ resolveEntity(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *systemId)
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
xmlEntityPtr
getEntity(xmlParserCtxtPtr ctxt, const CHAR *name)
getEntity(void *ctx, const CHAR *name)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlEntityPtr ret;
#ifdef DEBUG_SAX
@ -204,9 +214,10 @@ getEntity(xmlParserCtxtPtr ctxt, const CHAR *name)
* An entity definition has been parsed
*/
void
entityDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
entityDecl(void *ctx, const CHAR *name, int type,
const CHAR *publicId, const CHAR *systemId, CHAR *content)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
@ -227,10 +238,11 @@ entityDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
* An attribute definition has been parsed
*/
void
attributeDecl(xmlParserCtxtPtr ctxt, const CHAR *elem, const CHAR *name,
attributeDecl(void *ctx, const CHAR *elem, const CHAR *name,
int type, int def, const CHAR *defaultValue,
xmlEnumerationPtr tree)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
@ -252,9 +264,10 @@ attributeDecl(xmlParserCtxtPtr ctxt, const CHAR *elem, const CHAR *name,
* An element definition has been parsed
*/
void
elementDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
elementDecl(void *ctx, const CHAR *name, int type,
xmlElementContentPtr content)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n",
@ -274,9 +287,10 @@ elementDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
* TODO Not handled currently.
*/
void
notationDecl(xmlParserCtxtPtr ctxt, const CHAR *name,
notationDecl(void *ctx, const CHAR *name,
const CHAR *publicId, const CHAR *systemId)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId);
#endif
@ -295,10 +309,11 @@ notationDecl(xmlParserCtxtPtr ctxt, const CHAR *name,
* TODO Create an Entity node.
*/
void
unparsedEntityDecl(xmlParserCtxtPtr ctxt, const CHAR *name,
unparsedEntityDecl(void *ctx, const CHAR *name,
const CHAR *publicId, const CHAR *systemId,
const CHAR *notationName)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
name, publicId, systemId, notationName);
@ -314,8 +329,9 @@ unparsedEntityDecl(xmlParserCtxtPtr ctxt, const CHAR *name,
* Everything is available on the context, so this is useless in our case.
*/
void
setDocumentLocator(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
setDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.setDocumentLocator()\n");
#endif
@ -328,8 +344,9 @@ setDocumentLocator(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
* called when the document start being processed.
*/
void
startDocument(xmlParserCtxtPtr ctxt)
startDocument(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlDocPtr doc;
#ifdef DEBUG_SAX
@ -352,8 +369,9 @@ startDocument(xmlParserCtxtPtr ctxt)
* called when the document end has been detected.
*/
void
endDocument(xmlParserCtxtPtr ctxt)
endDocument(void *ctx)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.endDocument()\n");
#endif
@ -371,8 +389,9 @@ endDocument(xmlParserCtxtPtr ctxt)
* the element.
*/
void
attribute(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR *value)
attribute(void *ctx, const CHAR *fullname, const CHAR *value)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlAttrPtr ret;
CHAR *name;
CHAR *ns;
@ -428,8 +447,9 @@ attribute(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR *value)
* TODO We currently have a small pblm with the arguments ...
*/
void
startElement(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR **atts)
startElement(void *ctx, const CHAR *fullname, const CHAR **atts)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr ret;
xmlNodePtr parent = ctxt->node;
xmlNsPtr ns;
@ -515,8 +535,9 @@ startElement(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR **atts)
* called when the end of an element has been detected.
*/
void
endElement(xmlParserCtxtPtr ctxt, const CHAR *name)
endElement(void *ctx, const CHAR *name)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlParserNodeInfo node_info;
xmlNodePtr cur = ctxt->node;
@ -549,8 +570,9 @@ endElement(xmlParserCtxtPtr ctxt, const CHAR *name)
* called when an entity reference is detected.
*/
void
reference(xmlParserCtxtPtr ctxt, const CHAR *name)
reference(void *ctx, const CHAR *name)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr ret;
#ifdef DEBUG_SAX
@ -570,8 +592,9 @@ reference(xmlParserCtxtPtr ctxt, const CHAR *name)
* Question: how much at a time ???
*/
void
characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
characters(void *ctx, const CHAR *ch, int len)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr lastChild;
#ifdef DEBUG_SAX
@ -606,8 +629,9 @@ characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
* Question: how much at a time ???
*/
void
ignorableWhitespace(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
ignorableWhitespace(void *ctx, const CHAR *ch, int len)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.ignorableWhitespace(%.30s, %d)\n", ch, len);
#endif
@ -623,9 +647,10 @@ ignorableWhitespace(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
* A processing instruction has been parsed.
*/
void
processingInstruction(xmlParserCtxtPtr ctxt, const CHAR *target,
processingInstruction(void *ctx, const CHAR *target,
const CHAR *data)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.processingInstruction(%s, %s)\n", target, data);
#endif
@ -640,8 +665,9 @@ processingInstruction(xmlParserCtxtPtr ctxt, const CHAR *target,
* An old global namespace has been parsed.
*/
void
globalNamespace(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
globalNamespace(void *ctx, const CHAR *href, const CHAR *prefix)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.globalNamespace(%s, %s)\n", href, prefix);
#endif
@ -656,8 +682,9 @@ globalNamespace(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
* Set the current element namespace.
*/
void
setNamespace(xmlParserCtxtPtr ctxt, const CHAR *name)
setNamespace(void *ctx, const CHAR *name)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNsPtr ns;
xmlNodePtr parent;
@ -682,8 +709,9 @@ setNamespace(xmlParserCtxtPtr ctxt, const CHAR *name)
* Get the current element namespace.
*/
xmlNsPtr
getNamespace(xmlParserCtxtPtr ctxt)
getNamespace(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNsPtr ret;
#ifdef DEBUG_SAX
@ -702,8 +730,9 @@ getNamespace(xmlParserCtxtPtr ctxt)
* one read upon parsing.
*/
int
checkNamespace(xmlParserCtxtPtr ctxt, CHAR *namespace)
checkNamespace(void *ctx, CHAR *namespace)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
xmlNodePtr cur = ctxt->node;
#ifdef DEBUG_SAX
@ -749,8 +778,9 @@ checkNamespace(xmlParserCtxtPtr ctxt, CHAR *namespace)
* A namespace has been parsed.
*/
void
namespaceDecl(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
namespaceDecl(void *ctx, const CHAR *href, const CHAR *prefix)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
if (prefix == NULL)
fprintf(stderr, "SAX.namespaceDecl(%s, NULL)\n", href);
@ -768,8 +798,9 @@ namespaceDecl(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
* A comment has been parsed.
*/
void
comment(xmlParserCtxtPtr ctxt, const CHAR *value)
comment(void *ctx, const CHAR *value)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
#ifdef DEBUG_SAX
fprintf(stderr, "SAX.comment(%s)\n", value);
#endif

@ -19,6 +19,7 @@
* Daniel.Veillard@w3.org
*/
#include <ctype.h>
#include "encoding.h"
/*
@ -204,3 +205,109 @@ UTF8ToUTF16(unsigned short* out, int outlen, unsigned char* in, int inlen)
}
/**
* xmlDetectCharEncoding:
* @in: a pointer to the first bytes of the XML entity, must be at least
* 4 bytes long.
*
* Guess the encoding of the entity using the first bytes of the entity content
* accordingly of the non-normative appendix F of the XML-1.0 recommendation.
*
* Returns one of the XML_CHAR_ENCODING_... values.
*/
xmlCharEncoding
xmlDetectCharEncoding(unsigned char* in)
{
if ((in[0] == 0x00) && (in[1] == 0x00) &&
(in[2] == 0x00) && (in[3] == 0x3C))
return(XML_CHAR_ENCODING_UCS4BE);
if ((in[0] == 0x3C) && (in[1] == 0x00) &&
(in[2] == 0x00) && (in[3] == 0x00))
return(XML_CHAR_ENCODING_UCS4LE);
if ((in[0] == 0x00) && (in[1] == 0x00) &&
(in[2] == 0x3C) && (in[3] == 0x00))
return(XML_CHAR_ENCODING_UCS4_2143);
if ((in[0] == 0x00) && (in[1] == 0x3C) &&
(in[2] == 0x00) && (in[3] == 0x00))
return(XML_CHAR_ENCODING_UCS4_3412);
if ((in[0] == 0xFE) && (in[1] == 0xFF))
return(XML_CHAR_ENCODING_UTF16BE);
if ((in[0] == 0xFF) && (in[1] == 0xFE))
return(XML_CHAR_ENCODING_UTF16LE);
if ((in[0] == 0x4C) && (in[1] == 0x6F) &&
(in[2] == 0xA7) && (in[3] == 0x94))
return(XML_CHAR_ENCODING_EBCDIC);
if ((in[0] == 0x3C) && (in[1] == 0x3F) &&
(in[2] == 0x78) && (in[3] == 0x6D))
return(XML_CHAR_ENCODING_UTF8);
return(XML_CHAR_ENCODING_NONE);
}
/**
* xmlParseCharEncoding:
* @name: the encoding name as parsed, in UTF-8 format (ASCCI actually)
*
* Conpare the string to the known encoding schemes already known. Note
* that the comparison is case insensitive accordingly to the section
* [XML] 4.3.3 Character Encoding in Entities.
*
* Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE
* if not recognized.
*/
xmlCharEncoding
xmlParseCharEncoding(char* name)
{
char upper[500];
int i;
for (i = 0;i < 499;i++) {
upper[i] = toupper(name[i]);
if (upper[i] == 0) break;
}
upper[i] = 0;
if (!strcmp(upper, "")) return(XML_CHAR_ENCODING_NONE);
if (!strcmp(upper, "UTF-8")) return(XML_CHAR_ENCODING_UTF8);
if (!strcmp(upper, "UTF8")) return(XML_CHAR_ENCODING_UTF8);
/*
* NOTE: if we were able to parse this, the endianness of UTF16 is
* already found and in use
*/
if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE);
if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE);
if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2);
if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2);
if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2);
/*
* NOTE: if we were able to parse this, the endianness of UCS4 is
* already found and in use
*/
if (!strcmp(upper, "ISO-10646-UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE);
if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE);
if (!strcmp(upper, "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1);
if (!strcmp(upper, "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1);
if (!strcmp(upper, "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1);
if (!strcmp(upper, "ISO-8859-2")) return(XML_CHAR_ENCODING_8859_2);
if (!strcmp(upper, "ISO-LATIN-2")) return(XML_CHAR_ENCODING_8859_2);
if (!strcmp(upper, "ISO LATIN 2")) return(XML_CHAR_ENCODING_8859_2);
if (!strcmp(upper, "ISO-8859-3")) return(XML_CHAR_ENCODING_8859_3);
if (!strcmp(upper, "ISO-8859-4")) return(XML_CHAR_ENCODING_8859_4);
if (!strcmp(upper, "ISO-8859-5")) return(XML_CHAR_ENCODING_8859_5);
if (!strcmp(upper, "ISO-8859-6")) return(XML_CHAR_ENCODING_8859_6);
if (!strcmp(upper, "ISO-8859-7")) return(XML_CHAR_ENCODING_8859_7);
if (!strcmp(upper, "ISO-8859-8")) return(XML_CHAR_ENCODING_8859_8);
if (!strcmp(upper, "ISO-8859-9")) return(XML_CHAR_ENCODING_8859_9);
if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP);
if (!strcmp(upper, "Shift_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS);
if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP);
return(XML_CHAR_ENCODING_ERROR);
}

@ -13,22 +13,49 @@
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
* Information Interchange, ANSI X3.4-1986.
*
* Original code from "Martin J. Duerst" <duerst@w3.org>
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@w3.org
*/
#ifndef __XML_ENCODING_H__
#define __XML_ENCODING_H__
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
} xmlCharEncoding;
extern xmlCharEncoding xmlDetectCharEncoding(unsigned char* in);
extern xmlCharEncoding xmlParseCharEncoding(char* name);
#ifdef __cplusplus
}
#endif
#endif /* __XML_ENCODING_H__ */
#endif /* __XML_CHAR_ENCODING_H__ */

@ -20,8 +20,9 @@
* extra parameters.
*/
void
xmlParserError(xmlParserCtxtPtr ctxt, const char *msg, ...)
xmlParserError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
const CHAR *cur, *base;
va_list args;
int n;
@ -73,8 +74,9 @@ xmlParserError(xmlParserCtxtPtr ctxt, const char *msg, ...)
* extra parameters.
*/
void
xmlParserWarning(xmlParserCtxtPtr ctxt, const char *msg, ...)
xmlParserWarning(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
const CHAR *cur, *base;
va_list args;
int n;

@ -13,22 +13,49 @@
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
* Information Interchange, ANSI X3.4-1986.
*
* Original code from "Martin J. Duerst" <duerst@w3.org>
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@w3.org
*/
#ifndef __XML_ENCODING_H__
#define __XML_ENCODING_H__
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
} xmlCharEncoding;
extern xmlCharEncoding xmlDetectCharEncoding(unsigned char* in);
extern xmlCharEncoding xmlParseCharEncoding(char* name);
#ifdef __cplusplus
}
#endif
#endif /* __XML_ENCODING_H__ */
#endif /* __XML_CHAR_ENCODING_H__ */

@ -81,10 +81,10 @@ typedef xmlParserCtxt *xmlParserCtxtPtr;
*/
typedef struct xmlSAXLocator {
const CHAR *(*getPublicId)(xmlParserCtxtPtr ctxt);
const CHAR *(*getSystemId)(xmlParserCtxtPtr ctxt);
int (*getLineNumber)(xmlParserCtxtPtr ctxt);
int (*getColumnNumber)(xmlParserCtxtPtr ctxt);
const CHAR *(*getPublicId)(void *ctx);
const CHAR *(*getSystemId)(void *ctx);
int (*getLineNumber)(void *ctx);
int (*getColumnNumber)(void *ctx);
} _xmlSAXLocator;
typedef _xmlSAXLocator xmlSAXLocator;
typedef xmlSAXLocator *xmlSAXLocatorPtr;
@ -95,48 +95,48 @@ typedef xmlSAXLocator *xmlSAXLocatorPtr;
#include "entities.h"
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
const CHAR *publicId, const CHAR *systemId);
typedef void (*internalSubsetSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*internalSubsetSAXFunc) (void *ctx, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID);
typedef xmlEntityPtr (*getEntitySAXFunc) (xmlParserCtxtPtr ctxt,
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
const CHAR *name);
typedef void (*entityDeclSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*entityDeclSAXFunc) (void *ctx,
const CHAR *name, int type, const CHAR *publicId,
const CHAR *systemId, CHAR *content);
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*notationDeclSAXFunc)(void *ctx, const CHAR *name,
const CHAR *publicId, const CHAR *systemId);
typedef void (*attributeDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *elem,
typedef void (*attributeDeclSAXFunc)(void *ctx, const CHAR *elem,
const CHAR *name, int type, int def,
const CHAR *defaultValue, xmlEnumerationPtr tree);
typedef void (*elementDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*elementDeclSAXFunc)(void *ctx, const CHAR *name,
int type, xmlElementContentPtr content);
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
const CHAR *name, const CHAR *publicId,
const CHAR *systemId, const CHAR *notationName);
typedef void (*setDocumentLocatorSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
xmlSAXLocatorPtr loc);
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*startDocumentSAXFunc) (void *ctx);
typedef void (*endDocumentSAXFunc) (void *ctx);
typedef void (*startElementSAXFunc) (void *ctx, const CHAR *name,
const CHAR **atts);
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*endElementSAXFunc) (void *ctx, const CHAR *name);
typedef void (*attributeSAXFunc) (void *ctx, const CHAR *name,
const CHAR *value);
typedef void (*referenceSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
typedef void (*referenceSAXFunc) (void *ctx, const CHAR *name);
typedef void (*charactersSAXFunc) (void *ctx, const CHAR *ch,
int len);
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
const CHAR *ch, int len);
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*processingInstructionSAXFunc) (void *ctx,
const CHAR *target, const CHAR *data);
typedef void (*commentSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *value);
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef void (*fatalErrorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef int (*isStandaloneSAXFunc) (xmlParserCtxtPtr ctxt);
typedef int (*hasInternalSubsetSAXFunc) (xmlParserCtxtPtr ctxt);
typedef int (*hasExternalSubsetSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*commentSAXFunc) (void *ctx, const CHAR *value);
typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
typedef int (*isStandaloneSAXFunc) (void *ctx);
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
typedef struct xmlSAXHandler {
internalSubsetSAXFunc internalSubset;

493
parser.c

File diff suppressed because it is too large Load Diff

@ -81,10 +81,10 @@ typedef xmlParserCtxt *xmlParserCtxtPtr;
*/
typedef struct xmlSAXLocator {
const CHAR *(*getPublicId)(xmlParserCtxtPtr ctxt);
const CHAR *(*getSystemId)(xmlParserCtxtPtr ctxt);
int (*getLineNumber)(xmlParserCtxtPtr ctxt);
int (*getColumnNumber)(xmlParserCtxtPtr ctxt);
const CHAR *(*getPublicId)(void *ctx);
const CHAR *(*getSystemId)(void *ctx);
int (*getLineNumber)(void *ctx);
int (*getColumnNumber)(void *ctx);
} _xmlSAXLocator;
typedef _xmlSAXLocator xmlSAXLocator;
typedef xmlSAXLocator *xmlSAXLocatorPtr;
@ -95,48 +95,48 @@ typedef xmlSAXLocator *xmlSAXLocatorPtr;
#include "entities.h"
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
const CHAR *publicId, const CHAR *systemId);
typedef void (*internalSubsetSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*internalSubsetSAXFunc) (void *ctx, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID);
typedef xmlEntityPtr (*getEntitySAXFunc) (xmlParserCtxtPtr ctxt,
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
const CHAR *name);
typedef void (*entityDeclSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*entityDeclSAXFunc) (void *ctx,
const CHAR *name, int type, const CHAR *publicId,
const CHAR *systemId, CHAR *content);
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*notationDeclSAXFunc)(void *ctx, const CHAR *name,
const CHAR *publicId, const CHAR *systemId);
typedef void (*attributeDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *elem,
typedef void (*attributeDeclSAXFunc)(void *ctx, const CHAR *elem,
const CHAR *name, int type, int def,
const CHAR *defaultValue, xmlEnumerationPtr tree);
typedef void (*elementDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*elementDeclSAXFunc)(void *ctx, const CHAR *name,
int type, xmlElementContentPtr content);
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
const CHAR *name, const CHAR *publicId,
const CHAR *systemId, const CHAR *notationName);
typedef void (*setDocumentLocatorSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
xmlSAXLocatorPtr loc);
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*startDocumentSAXFunc) (void *ctx);
typedef void (*endDocumentSAXFunc) (void *ctx);
typedef void (*startElementSAXFunc) (void *ctx, const CHAR *name,
const CHAR **atts);
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
typedef void (*endElementSAXFunc) (void *ctx, const CHAR *name);
typedef void (*attributeSAXFunc) (void *ctx, const CHAR *name,
const CHAR *value);
typedef void (*referenceSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
typedef void (*referenceSAXFunc) (void *ctx, const CHAR *name);
typedef void (*charactersSAXFunc) (void *ctx, const CHAR *ch,
int len);
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
const CHAR *ch, int len);
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
typedef void (*processingInstructionSAXFunc) (void *ctx,
const CHAR *target, const CHAR *data);
typedef void (*commentSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *value);
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef void (*fatalErrorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
typedef int (*isStandaloneSAXFunc) (xmlParserCtxtPtr ctxt);
typedef int (*hasInternalSubsetSAXFunc) (xmlParserCtxtPtr ctxt);
typedef int (*hasExternalSubsetSAXFunc) (xmlParserCtxtPtr ctxt);
typedef void (*commentSAXFunc) (void *ctx, const CHAR *value);
typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
typedef int (*isStandaloneSAXFunc) (void *ctx);
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
typedef struct xmlSAXHandler {
internalSubsetSAXFunc internalSubset;

@ -104,7 +104,7 @@ static CHAR buffer[] =
int
isStandaloneDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.isStandalone()\n");
fprintf(stdout, "SAX.isStandalone()\n");
return(0);
}
@ -119,7 +119,7 @@ isStandaloneDebug(xmlParserCtxtPtr ctxt)
int
hasInternalSubsetDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.hasInternalSubset()\n");
fprintf(stdout, "SAX.hasInternalSubset()\n");
return(0);
}
@ -134,7 +134,7 @@ hasInternalSubsetDebug(xmlParserCtxtPtr ctxt)
int
hasExternalSubsetDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.hasExternalSubset()\n");
fprintf(stdout, "SAX.hasExternalSubset()\n");
return(0);
}
@ -148,7 +148,7 @@ void
internalSubsetDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *ExternalID, const CHAR *SystemID)
{
fprintf(stderr, "SAX.internalSubset(%s, %s, %s)\n",
fprintf(stdout, "SAX.internalSubset(%s, %s, %s)\n",
name, ExternalID, SystemID);
}
@ -169,7 +169,7 @@ internalSubsetDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
xmlParserInputPtr
resolveEntityDebug(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *systemId)
{
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n",
fprintf(stdout, "SAX.resolveEntity(%s, %s)\n",
(char *)publicId, (char *)systemId);
return(NULL);
}
@ -186,7 +186,7 @@ resolveEntityDebug(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *syst
xmlEntityPtr
getEntityDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.getEntity(%s)\n", name);
fprintf(stdout, "SAX.getEntity(%s)\n", name);
return(NULL);
}
@ -206,7 +206,7 @@ void
entityDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
const CHAR *publicId, const CHAR *systemId, CHAR *content)
{
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
name, type, publicId, systemId, content);
}
@ -223,7 +223,7 @@ attributeDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *elem, const CHAR *name,
int type, int def, const CHAR *defaultValue,
xmlEnumerationPtr tree)
{
fprintf(stderr, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
elem, name, type, def, defaultValue);
}
@ -240,7 +240,7 @@ void
elementDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
xmlElementContentPtr content)
{
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n",
fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n",
name, type);
}
@ -258,7 +258,7 @@ void
notationDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *publicId, const CHAR *systemId)
{
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n",
fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n",
(char *) name, (char *) publicId, (char *) systemId);
}
@ -278,7 +278,7 @@ unparsedEntityDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
const CHAR *publicId, const CHAR *systemId,
const CHAR *notationName)
{
fprintf(stderr, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n",
(char *) name, (char *) publicId, (char *) systemId,
(char *) notationName);
}
@ -294,7 +294,7 @@ unparsedEntityDeclDebug(xmlParserCtxtPtr ctxt, const CHAR *name,
void
setDocumentLocatorDebug(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
{
fprintf(stderr, "SAX.setDocumentLocator()\n");
fprintf(stdout, "SAX.setDocumentLocator()\n");
}
/**
@ -306,7 +306,7 @@ setDocumentLocatorDebug(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
void
startDocumentDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.startDocument()\n");
fprintf(stdout, "SAX.startDocument()\n");
}
/**
@ -318,7 +318,7 @@ startDocumentDebug(xmlParserCtxtPtr ctxt)
void
endDocumentDebug(xmlParserCtxtPtr ctxt)
{
fprintf(stderr, "SAX.endDocument()\n");
fprintf(stdout, "SAX.endDocument()\n");
}
/**
@ -334,14 +334,14 @@ startElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name, const CHAR **atts)
{
int i;
fprintf(stderr, "SAX.startElement(%s", (char *) name);
fprintf(stdout, "SAX.startElement(%s", (char *) name);
if (atts != NULL) {
for (i = 0;(atts[i] != NULL);i++) {
fprintf(stderr, ", %s='", atts[i++]);
fprintf(stderr, "%s'", atts[i]);
fprintf(stdout, ", %s='", atts[i++]);
fprintf(stdout, "%s'", atts[i]);
}
}
fprintf(stderr, ")\n");
fprintf(stdout, ")\n");
}
/**
@ -354,7 +354,7 @@ startElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name, const CHAR **atts)
void
endElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.endElement(%s)\n", (char *) name);
fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
}
/**
@ -369,7 +369,7 @@ endElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
void
charactersDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
{
fprintf(stderr, "SAX.characters(%.30s, %d)\n", (char *) ch, len);
fprintf(stdout, "SAX.characters(%.30s, %d)\n", (char *) ch, len);
}
/**
@ -382,7 +382,7 @@ charactersDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
void
referenceDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
{
fprintf(stderr, "SAX.reference(%s)\n", name);
fprintf(stdout, "SAX.reference(%s)\n", name);
}
/**
@ -398,7 +398,7 @@ referenceDebug(xmlParserCtxtPtr ctxt, const CHAR *name)
void
ignorableWhitespaceDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
{
fprintf(stderr, "SAX.ignorableWhitespace(%.30s, %d)\n",
fprintf(stdout, "SAX.ignorableWhitespace(%.30s, %d)\n",
(char *) ch, len);
}
@ -415,7 +415,7 @@ void
processingInstructionDebug(xmlParserCtxtPtr ctxt, const CHAR *target,
const CHAR *data)
{
fprintf(stderr, "SAX.processingInstruction(%s, %s)\n",
fprintf(stdout, "SAX.processingInstruction(%s, %s)\n",
(char *) target, (char *) data);
}
@ -429,7 +429,7 @@ processingInstructionDebug(xmlParserCtxtPtr ctxt, const CHAR *target,
void
commentDebug(xmlParserCtxtPtr ctxt, const CHAR *value)
{
fprintf(stderr, "SAX.comment(%s)\n", value);
fprintf(stdout, "SAX.comment(%s)\n", value);
}
/**
@ -447,8 +447,8 @@ warningDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.warning: ");
vfprintf(stderr, msg, args);
fprintf(stdout, "SAX.warning: ");
vfprintf(stdout, msg, args);
va_end(args);
}
@ -467,8 +467,8 @@ errorDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.error: ");
vfprintf(stderr, msg, args);
fprintf(stdout, "SAX.error: ");
vfprintf(stdout, msg, args);
va_end(args);
}
@ -487,8 +487,8 @@ fatalErrorDebug(xmlParserCtxtPtr ctxt, const char *msg, ...)
va_list args;
va_start(args, msg);
fprintf(stderr, "SAX.fatalError: ");
vfprintf(stderr, msg, args);
fprintf(stdout, "SAX.fatalError: ");
vfprintf(stdout, msg, args);
va_end(args);
}
@ -535,7 +535,7 @@ void parseAndPrintFile(char *filename) {
*/
doc = xmlSAXParseFile(emptySAXHandler, filename, 0);
if (doc != NULL) {
fprintf(stderr, "xmlSAXParseFile returned non-NULL\n");
fprintf(stdout, "xmlSAXParseFile returned non-NULL\n");
xmlDocDump(stdout, doc);
}

12
tree.c

@ -395,7 +395,7 @@ xmlNewDoc(const CHAR *version) {
cur->encoding = NULL;
cur->standalone = -1;
cur->compression = xmlCompressMode;
#ifndef WITHOUT_CORBA
#ifndef XML_WITHOUT_CORBA
cur->_private = NULL;
cur->vepv = NULL;
#endif
@ -736,7 +736,7 @@ xmlNewProp(xmlNodePtr node, const CHAR *name, const CHAR *value) {
cur->val = xmlStringGetNodeList(node->doc, value);
else
cur->val = NULL;
#ifndef WITHOUT_CORBA
#ifndef XML_WITHOUT_CORBA
cur->_private = NULL;
cur->vepv = NULL;
#endif
@ -792,7 +792,7 @@ xmlNewDocProp(xmlDocPtr doc, const CHAR *name, const CHAR *value) {
cur->val = xmlStringGetNodeList(doc, value);
else
cur->val = NULL;
#ifndef WITHOUT_CORBA
#ifndef XML_WITHOUT_CORBA
cur->_private = NULL;
cur->vepv = NULL;
#endif
@ -879,7 +879,7 @@ xmlNewNode(xmlNsPtr ns, const CHAR *name) {
cur->ns = ns;
cur->nsDef = NULL;
cur->content = NULL;
#ifndef WITHOUT_CORBA
#ifndef XML_WITHOUT_CORBA
cur->_private = NULL;
cur->vepv = NULL;
#endif
@ -1502,7 +1502,7 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
ret->content = xmlStrdup(node->content);
else
ret->content = NULL;
#ifndef WITHOUT_CORBA
#ifndef XML_WITHOUT_CORBA
ret->_private = NULL;
ret->vepv = NULL;
#endif
@ -2776,9 +2776,7 @@ xmlSaveFile(const char *filename, xmlDocPtr cur) {
if (output == NULL) return(-1);
#ifdef HAVE_ZLIB_H
}
#endif
#ifdef HAVE_ZLIB_H
if (zoutput != NULL) {
ret = gzwrite(zoutput, buf->content, sizeof(CHAR) * buf->use);
gzclose(zoutput);

@ -3,6 +3,6 @@
#include "parser.h"
void xmlParserError(xmlParserCtxtPtr ctxt, const char *msg, ...);
void xmlParserWarning(xmlParserCtxtPtr ctxt, const char *msg, ...);
void xmlParserError(void *ctx, const char *msg, ...);
void xmlParserWarning(void *ctx, const char *msg, ...);
#endif