mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
Completed/revamped the SAX support, removed old namespace suppport, Daniel
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Mon Apr 5 14:14:40 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* parser.[ch] tree.[ch] SAX.c, parserInternals.h valid.[ch]:
|
||||||
|
large revamping of the parser to use SAX callbacks
|
||||||
|
http://www.megginson.com/SAX/ (or at least a C like interface
|
||||||
|
a la Expat). It's now possible to set up your own callbacks
|
||||||
|
and the parser will not build a DOM tree.
|
||||||
|
* test/* result/*: updated the test suite, I finally removed
|
||||||
|
the old Namespace draft support (PI based).
|
||||||
|
|
||||||
Fri Apr 2 17:57:32 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
Fri Apr 2 17:57:32 CEST 1999 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* Makefile.am: added test result to EXTRA_DIST for make tests
|
* Makefile.am: added test result to EXTRA_DIST for make tests
|
||||||
|
527
SAX.c
527
SAX.c
@ -10,6 +10,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
#include "parserInternals.h"
|
||||||
|
#include "valid.h"
|
||||||
#include "entities.h"
|
#include "entities.h"
|
||||||
#include "xml-error.h"
|
#include "xml-error.h"
|
||||||
|
|
||||||
@ -80,6 +82,65 @@ xmlSAXLocator xmlDefaultSAXLocator = {
|
|||||||
getPublicId, getSystemId, getLineNumber, getColumnNumber
|
getPublicId, getSystemId, getLineNumber, getColumnNumber
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isStandalone:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
*
|
||||||
|
* Is this document tagged standalone ?
|
||||||
|
*
|
||||||
|
* Returns 1 if true
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
isStandalone(xmlParserCtxtPtr ctxt)
|
||||||
|
{
|
||||||
|
return(ctxt->myDoc->standalone == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hasInternalSubset:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
*
|
||||||
|
* Does this document has an internal subset
|
||||||
|
*
|
||||||
|
* Returns 1 if true
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
hasInternalSubset(xmlParserCtxtPtr ctxt)
|
||||||
|
{
|
||||||
|
return(ctxt->myDoc->intSubset != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hasExternalSubset:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
*
|
||||||
|
* Does this document has an external subset
|
||||||
|
*
|
||||||
|
* Returns 1 if true
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
hasExternalSubset(xmlParserCtxtPtr ctxt)
|
||||||
|
{
|
||||||
|
return(ctxt->myDoc->extSubset != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hasInternalSubset:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
*
|
||||||
|
* Does this document has an internal subset
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
internalSubset(xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
const CHAR *ExternalID, const CHAR *SystemID)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.internalSubset(%s, %s, %s)\n",
|
||||||
|
name, ExternalID, SystemID);
|
||||||
|
#endif
|
||||||
|
xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resolveEntity:
|
* resolveEntity:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
@ -102,9 +163,106 @@ resolveEntity(xmlParserCtxtPtr ctxt, const CHAR *publicId, const CHAR *systemId)
|
|||||||
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n", publicId, systemId);
|
fprintf(stderr, "SAX.resolveEntity(%s, %s)\n", publicId, systemId);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO : not 100% sure that the appropriate handling in that case.
|
||||||
|
*/
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getEntity:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: The entity name
|
||||||
|
*
|
||||||
|
* Get an entity by name
|
||||||
|
*
|
||||||
|
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
|
||||||
|
*/
|
||||||
|
xmlEntityPtr
|
||||||
|
getEntity(xmlParserCtxtPtr ctxt, const CHAR *name)
|
||||||
|
{
|
||||||
|
xmlEntityPtr ret;
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.getEntity(%s)\n", name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ret = xmlGetDocEntity(ctxt->myDoc, name);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* entityDecl:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: the entity name
|
||||||
|
* @type: the entity type
|
||||||
|
* @publicId: The public ID of the entity
|
||||||
|
* @systemId: The system ID of the entity
|
||||||
|
* @content: the entity value (without processing).
|
||||||
|
*
|
||||||
|
* An entity definition has been parsed
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
entityDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
|
||||||
|
const CHAR *publicId, const CHAR *systemId, CHAR *content)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n",
|
||||||
|
name, type, publicId, systemId, content);
|
||||||
|
#endif
|
||||||
|
xmlAddDocEntity(ctxt->myDoc, name, type, publicId, systemId, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attributeDecl:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: the attribute name
|
||||||
|
* @type: the attribute type
|
||||||
|
* @publicId: The public ID of the attribute
|
||||||
|
* @systemId: The system ID of the attribute
|
||||||
|
* @content: the attribute value (without processing).
|
||||||
|
*
|
||||||
|
* An attribute definition has been parsed
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
attributeDecl(xmlParserCtxtPtr ctxt, const CHAR *elem, const CHAR *name,
|
||||||
|
int type, int def, const CHAR *defaultValue,
|
||||||
|
xmlEnumerationPtr tree)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n",
|
||||||
|
elem, name, type, def, defaultValue);
|
||||||
|
#endif
|
||||||
|
xmlAddAttributeDecl(ctxt->myDoc->intSubset, elem, name, type, def,
|
||||||
|
defaultValue, tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* elementDecl:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: the element name
|
||||||
|
* @type: the element type
|
||||||
|
* @publicId: The public ID of the element
|
||||||
|
* @systemId: The system ID of the element
|
||||||
|
* @content: the element value (without processing).
|
||||||
|
*
|
||||||
|
* An element definition has been parsed
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
elementDecl(xmlParserCtxtPtr ctxt, const CHAR *name, int type,
|
||||||
|
xmlElementContentPtr content)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n",
|
||||||
|
name, type);
|
||||||
|
#endif
|
||||||
|
xmlAddElementDecl(ctxt->myDoc->intSubset, name, type, content);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* notationDecl:
|
* notationDecl:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
@ -122,6 +280,7 @@ notationDecl(xmlParserCtxtPtr ctxt, const CHAR *name,
|
|||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId);
|
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId);
|
||||||
#endif
|
#endif
|
||||||
|
xmlAddNotationDecl(ctxt->myDoc->intSubset, name, publicId, systemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,9 +330,19 @@ setDocumentLocator(xmlParserCtxtPtr ctxt, xmlSAXLocatorPtr loc)
|
|||||||
void
|
void
|
||||||
startDocument(xmlParserCtxtPtr ctxt)
|
startDocument(xmlParserCtxtPtr ctxt)
|
||||||
{
|
{
|
||||||
|
xmlDocPtr doc;
|
||||||
|
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.startDocument()\n");
|
fprintf(stderr, "SAX.startDocument()\n");
|
||||||
#endif
|
#endif
|
||||||
|
doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
|
||||||
|
if (doc != NULL) {
|
||||||
|
if (ctxt->encoding != NULL)
|
||||||
|
doc->encoding = xmlStrdup(ctxt->encoding);
|
||||||
|
else
|
||||||
|
doc->encoding = NULL;
|
||||||
|
doc->standalone = ctxt->standalone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,20 +359,152 @@ endDocument(xmlParserCtxtPtr ctxt)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attribute:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: The attribute name
|
||||||
|
* @value: The attribute value
|
||||||
|
*
|
||||||
|
* Handle an attribute that has been read by the parser.
|
||||||
|
* The default handling is to convert the attribute into an
|
||||||
|
* DOM subtree and past it in a new xmlAttr element added to
|
||||||
|
* the element.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
attribute(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR *value)
|
||||||
|
{
|
||||||
|
xmlAttrPtr ret;
|
||||||
|
CHAR *name;
|
||||||
|
CHAR *ns;
|
||||||
|
|
||||||
|
/****************
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.attribute(%s, %s)\n", fullname, value);
|
||||||
|
#endif
|
||||||
|
****************/
|
||||||
|
/*
|
||||||
|
* Split the full name into a namespace prefix and the tag name
|
||||||
|
*/
|
||||||
|
name = xmlSplitQName(fullname, &ns);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether it's a namespace definition
|
||||||
|
*/
|
||||||
|
if ((ns == NULL) &&
|
||||||
|
(name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') &&
|
||||||
|
(name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) {
|
||||||
|
/* a default namespace definition */
|
||||||
|
xmlNewNs(ctxt->node, value, NULL);
|
||||||
|
if (name != NULL)
|
||||||
|
free(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') &&
|
||||||
|
(ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) {
|
||||||
|
/* a standard namespace definition */
|
||||||
|
xmlNewNs(ctxt->node, value, name);
|
||||||
|
free(ns);
|
||||||
|
if (name != NULL)
|
||||||
|
free(name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = xmlNewProp(ctxt->node, name, NULL);
|
||||||
|
if (ret != NULL)
|
||||||
|
ret->val = xmlStringGetNodeList(ctxt->myDoc, value);
|
||||||
|
if (name != NULL)
|
||||||
|
free(name);
|
||||||
|
if (ns != NULL)
|
||||||
|
free(ns);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startElement:
|
* startElement:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
* @name: The element name
|
* @name: The element name
|
||||||
|
* @atts: An array of name/value attributes pairs, NULL terminated
|
||||||
*
|
*
|
||||||
* called when an opening tag has been processed.
|
* called when an opening tag has been processed.
|
||||||
* TODO We currently have a small pblm with the arguments ...
|
* TODO We currently have a small pblm with the arguments ...
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
startElement(xmlParserCtxtPtr ctxt, const CHAR *name)
|
startElement(xmlParserCtxtPtr ctxt, const CHAR *fullname, const CHAR **atts)
|
||||||
{
|
{
|
||||||
|
xmlNodePtr ret;
|
||||||
|
xmlNodePtr parent = ctxt->node;
|
||||||
|
xmlNsPtr ns;
|
||||||
|
CHAR *name;
|
||||||
|
CHAR *prefix;
|
||||||
|
const CHAR *att;
|
||||||
|
const CHAR *value;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.startElement(%s)\n", name);
|
fprintf(stderr, "SAX.startElement(%s)\n", fullname);
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* Split the full name into a namespace prefix and the tag name
|
||||||
|
*/
|
||||||
|
name = xmlSplitQName(fullname, &prefix);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note : the namespace resolution is deferred until the end of the
|
||||||
|
* attributes parsing, since local namespace can be defined as
|
||||||
|
* an attribute at this level.
|
||||||
|
*/
|
||||||
|
ret = xmlNewDocNode(ctxt->myDoc, NULL, name, NULL);
|
||||||
|
if (ret == NULL) return;
|
||||||
|
if (ctxt->myDoc->root == NULL)
|
||||||
|
ctxt->myDoc->root = ret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We are parsing a new node.
|
||||||
|
*/
|
||||||
|
nodePush(ctxt, ret);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Link the child element
|
||||||
|
*/
|
||||||
|
if (parent != NULL)
|
||||||
|
xmlAddChild(parent, ctxt->node);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* process all the attributes.
|
||||||
|
*/
|
||||||
|
if (atts != NULL) {
|
||||||
|
i = 0;
|
||||||
|
att = atts[i++];
|
||||||
|
value = atts[i++];
|
||||||
|
while ((att != NULL) && (value != NULL)) {
|
||||||
|
/*
|
||||||
|
* Handle one pair of attribute/value
|
||||||
|
*/
|
||||||
|
attribute(ctxt, att, value);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Next ones
|
||||||
|
*/
|
||||||
|
att = atts[i++];
|
||||||
|
value = atts[i++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search the namespace, note that since the attributes have been
|
||||||
|
* processed, the local namespaces are available.
|
||||||
|
*/
|
||||||
|
ns = xmlSearchNs(ctxt->myDoc, ret, prefix);
|
||||||
|
if ((ns == NULL) && (parent != NULL))
|
||||||
|
ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
|
||||||
|
xmlSetNs(ret, ns);
|
||||||
|
|
||||||
|
if (prefix != NULL)
|
||||||
|
free(prefix);
|
||||||
|
if (name != NULL)
|
||||||
|
free(name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,47 +517,65 @@ startElement(xmlParserCtxtPtr ctxt, const CHAR *name)
|
|||||||
void
|
void
|
||||||
endElement(xmlParserCtxtPtr ctxt, const CHAR *name)
|
endElement(xmlParserCtxtPtr ctxt, const CHAR *name)
|
||||||
{
|
{
|
||||||
|
xmlParserNodeInfo node_info;
|
||||||
|
xmlNodePtr cur = ctxt->node;
|
||||||
|
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.endElement(%s)\n", name);
|
if (name == NULL)
|
||||||
|
fprintf(stderr, "SAX.endElement(NULL)\n");
|
||||||
|
else
|
||||||
|
fprintf(stderr, "SAX.endElement(%s)\n", name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Capture end position and add node */
|
||||||
|
if (cur != NULL && ctxt->record_info) {
|
||||||
|
node_info.end_pos = ctxt->input->cur - ctxt->input->base;
|
||||||
|
node_info.end_line = ctxt->input->line;
|
||||||
|
node_info.node = cur;
|
||||||
|
xmlParserAddNodeInfo(ctxt, &node_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* end of parsing of this node.
|
||||||
|
*/
|
||||||
|
nodePop(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* attribute:
|
* reference:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
* @name: The attribute name
|
* @name: The entity name
|
||||||
* @value: The attribute value
|
|
||||||
*
|
*
|
||||||
* called when an attribute has been read by the parser.
|
* called when an entity reference is detected.
|
||||||
* The default handling is to convert the attribute into an
|
|
||||||
* DOM subtree and past it in a new xmlAttr element added to
|
|
||||||
* the element.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
attribute(xmlParserCtxtPtr ctxt, const CHAR *name, const CHAR *value)
|
reference(xmlParserCtxtPtr ctxt, const CHAR *name)
|
||||||
{
|
{
|
||||||
|
xmlNodePtr ret;
|
||||||
|
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.attribute(%s, %s)\n", name, value);
|
fprintf(stderr, "SAX.reference(%s)\n", name);
|
||||||
#endif
|
#endif
|
||||||
|
ret = xmlNewReference(ctxt->myDoc, name);
|
||||||
|
xmlAddChild(ctxt->node, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* characters:
|
* characters:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
* @ch: a CHAR string
|
* @ch: a CHAR string
|
||||||
* @start: the first char in the string
|
|
||||||
* @len: the number of CHAR
|
* @len: the number of CHAR
|
||||||
*
|
*
|
||||||
* receiving some chars from the parser.
|
* receiving some chars from the parser.
|
||||||
* Question: how much at a time ???
|
* Question: how much at a time ???
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int start, int len)
|
characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
|
||||||
{
|
{
|
||||||
xmlNodePtr lastChild;
|
xmlNodePtr lastChild;
|
||||||
|
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.characters(%.30s, %d, %d)\n", ch, start, len);
|
fprintf(stderr, "SAX.characters(%.30s, %d)\n", ch, len);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Handle the data if any. If there is no child
|
* Handle the data if any. If there is no child
|
||||||
@ -266,12 +585,12 @@ characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int start, int len)
|
|||||||
|
|
||||||
lastChild = xmlGetLastChild(ctxt->node);
|
lastChild = xmlGetLastChild(ctxt->node);
|
||||||
if (lastChild == NULL)
|
if (lastChild == NULL)
|
||||||
xmlNodeAddContentLen(ctxt->node, &ch[start], len);
|
xmlNodeAddContentLen(ctxt->node, ch, len);
|
||||||
else {
|
else {
|
||||||
if (xmlNodeIsText(lastChild))
|
if (xmlNodeIsText(lastChild))
|
||||||
xmlTextConcat(lastChild, &ch[start], len);
|
xmlTextConcat(lastChild, ch, len);
|
||||||
else {
|
else {
|
||||||
lastChild = xmlNewTextLen(&ch[start], len);
|
lastChild = xmlNewTextLen(ch, len);
|
||||||
xmlAddChild(ctxt->node, lastChild);
|
xmlAddChild(ctxt->node, lastChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,17 +600,16 @@ characters(xmlParserCtxtPtr ctxt, const CHAR *ch, int start, int len)
|
|||||||
* ignorableWhitespace:
|
* ignorableWhitespace:
|
||||||
* @ctxt: An XML parser context
|
* @ctxt: An XML parser context
|
||||||
* @ch: a CHAR string
|
* @ch: a CHAR string
|
||||||
* @start: the first char in the string
|
|
||||||
* @len: the number of CHAR
|
* @len: the number of CHAR
|
||||||
*
|
*
|
||||||
* receiving some ignorable whitespaces from the parser.
|
* receiving some ignorable whitespaces from the parser.
|
||||||
* Question: how much at a time ???
|
* Question: how much at a time ???
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ignorableWhitespace(xmlParserCtxtPtr ctxt, const CHAR *ch, int start, int len)
|
ignorableWhitespace(xmlParserCtxtPtr ctxt, const CHAR *ch, int len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SAX
|
#ifdef DEBUG_SAX
|
||||||
fprintf(stderr, "SAX.ignorableWhitespace(%.30s, %d, %d)\n", ch, start, len);
|
fprintf(stderr, "SAX.ignorableWhitespace(%.30s, %d)\n", ch, len);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,19 +631,173 @@ processingInstruction(xmlParserCtxtPtr ctxt, const CHAR *target,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* globalNamespace:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @href: the namespace associated URN
|
||||||
|
* @prefix: the namespace prefix
|
||||||
|
*
|
||||||
|
* An old global namespace has been parsed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
globalNamespace(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.globalNamespace(%s, %s)\n", href, prefix);
|
||||||
|
#endif
|
||||||
|
xmlNewGlobalNs(ctxt->myDoc, href, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setNamespace:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @name: the namespace prefix
|
||||||
|
*
|
||||||
|
* Set the current element namespace.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
setNamespace(xmlParserCtxtPtr ctxt, const CHAR *name)
|
||||||
|
{
|
||||||
|
xmlNsPtr ns;
|
||||||
|
xmlNodePtr parent;
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.setNamespace(%s)\n", name);
|
||||||
|
#endif
|
||||||
|
ns = xmlSearchNs(ctxt->myDoc, ctxt->node, name);
|
||||||
|
if (ns == NULL) { /* ctxt->node may not have a parent yet ! */
|
||||||
|
if (ctxt->nodeNr >= 2) {
|
||||||
|
parent = ctxt->nodeTab[ctxt->nodeNr - 2];
|
||||||
|
if (parent != NULL)
|
||||||
|
ns = xmlSearchNs(ctxt->myDoc, parent, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xmlSetNs(ctxt->node, ns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getNamespace:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
*
|
||||||
|
* Get the current element namespace.
|
||||||
|
*/
|
||||||
|
xmlNsPtr
|
||||||
|
getNamespace(xmlParserCtxtPtr ctxt)
|
||||||
|
{
|
||||||
|
xmlNsPtr ret;
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.getNamespace()\n");
|
||||||
|
#endif
|
||||||
|
ret = ctxt->node->ns;
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checkNamespace:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @namespace: the namespace to check against
|
||||||
|
*
|
||||||
|
* Check that the current element namespace is the same as the
|
||||||
|
* one read upon parsing.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
checkNamespace(xmlParserCtxtPtr ctxt, CHAR *namespace)
|
||||||
|
{
|
||||||
|
xmlNodePtr cur = ctxt->node;
|
||||||
|
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.checkNamespace(%s)\n", namespace);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that the Name in the ETag is the same as in the STag.
|
||||||
|
*/
|
||||||
|
if (namespace == NULL) {
|
||||||
|
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
|
||||||
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
|
ctxt->sax->error(ctxt,
|
||||||
|
"End tags for %s don't hold the namespace %s\n",
|
||||||
|
cur->name, cur->ns->prefix);
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((cur->ns == NULL) || (cur->ns->prefix == NULL)) {
|
||||||
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
|
ctxt->sax->error(ctxt,
|
||||||
|
"End tags %s holds a prefix %s not used by the open tag\n",
|
||||||
|
cur->name, namespace);
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
} else if (strcmp(namespace, cur->ns->prefix)) {
|
||||||
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||||
|
ctxt->sax->error(ctxt,
|
||||||
|
"Start and End tags for %s don't use the same namespaces: %s and %s\n",
|
||||||
|
cur->name, cur->ns->prefix, namespace);
|
||||||
|
ctxt->wellFormed = 0;
|
||||||
|
} else
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* namespaceDecl:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @href: the namespace associated URN
|
||||||
|
* @prefix: the namespace prefix
|
||||||
|
*
|
||||||
|
* A namespace has been parsed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
namespaceDecl(xmlParserCtxtPtr ctxt, const CHAR *href, const CHAR *prefix)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
if (prefix == NULL)
|
||||||
|
fprintf(stderr, "SAX.namespaceDecl(%s, NULL)\n", href);
|
||||||
|
else
|
||||||
|
fprintf(stderr, "SAX.namespaceDecl(%s, %s)\n", href, prefix);
|
||||||
|
#endif
|
||||||
|
xmlNewNs(ctxt->node, href, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* comment:
|
||||||
|
* @ctxt: An XML parser context
|
||||||
|
* @value: the comment content
|
||||||
|
*
|
||||||
|
* A comment has been parsed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
comment(xmlParserCtxtPtr ctxt, const CHAR *value)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_SAX
|
||||||
|
fprintf(stderr, "SAX.comment(%s)\n", value);
|
||||||
|
#endif
|
||||||
|
xmlNewDocComment(ctxt->myDoc, value);
|
||||||
|
}
|
||||||
|
|
||||||
xmlSAXHandler xmlDefaultSAXHandler = {
|
xmlSAXHandler xmlDefaultSAXHandler = {
|
||||||
|
internalSubset,
|
||||||
|
isStandalone,
|
||||||
|
hasInternalSubset,
|
||||||
|
hasExternalSubset,
|
||||||
resolveEntity,
|
resolveEntity,
|
||||||
|
getEntity,
|
||||||
|
entityDecl,
|
||||||
notationDecl,
|
notationDecl,
|
||||||
|
attributeDecl,
|
||||||
|
elementDecl,
|
||||||
unparsedEntityDecl,
|
unparsedEntityDecl,
|
||||||
setDocumentLocator,
|
setDocumentLocator,
|
||||||
startDocument,
|
startDocument,
|
||||||
endDocument,
|
endDocument,
|
||||||
startElement,
|
startElement,
|
||||||
endElement,
|
endElement,
|
||||||
attribute,
|
reference,
|
||||||
characters,
|
characters,
|
||||||
ignorableWhitespace,
|
ignorableWhitespace,
|
||||||
processingInstruction,
|
processingInstruction,
|
||||||
|
comment,
|
||||||
xmlParserWarning,
|
xmlParserWarning,
|
||||||
xmlParserError,
|
xmlParserError,
|
||||||
xmlParserError,
|
xmlParserError,
|
||||||
@ -339,7 +811,15 @@ xmlSAXHandler xmlDefaultSAXHandler = {
|
|||||||
void
|
void
|
||||||
xmlDefaultSAXHandlerInit(void)
|
xmlDefaultSAXHandlerInit(void)
|
||||||
{
|
{
|
||||||
|
xmlDefaultSAXHandler.internalSubset = internalSubset;
|
||||||
|
xmlDefaultSAXHandler.isStandalone = isStandalone;
|
||||||
|
xmlDefaultSAXHandler.hasInternalSubset = hasInternalSubset;
|
||||||
|
xmlDefaultSAXHandler.hasExternalSubset = hasExternalSubset;
|
||||||
xmlDefaultSAXHandler.resolveEntity = resolveEntity;
|
xmlDefaultSAXHandler.resolveEntity = resolveEntity;
|
||||||
|
xmlDefaultSAXHandler.getEntity = getEntity;
|
||||||
|
xmlDefaultSAXHandler.entityDecl = entityDecl;
|
||||||
|
xmlDefaultSAXHandler.attributeDecl = attributeDecl;
|
||||||
|
xmlDefaultSAXHandler.elementDecl = elementDecl;
|
||||||
xmlDefaultSAXHandler.notationDecl = notationDecl;
|
xmlDefaultSAXHandler.notationDecl = notationDecl;
|
||||||
xmlDefaultSAXHandler.unparsedEntityDecl = unparsedEntityDecl;
|
xmlDefaultSAXHandler.unparsedEntityDecl = unparsedEntityDecl;
|
||||||
xmlDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
|
xmlDefaultSAXHandler.setDocumentLocator = setDocumentLocator;
|
||||||
@ -347,10 +827,11 @@ xmlDefaultSAXHandlerInit(void)
|
|||||||
xmlDefaultSAXHandler.endDocument = endDocument;
|
xmlDefaultSAXHandler.endDocument = endDocument;
|
||||||
xmlDefaultSAXHandler.startElement = startElement;
|
xmlDefaultSAXHandler.startElement = startElement;
|
||||||
xmlDefaultSAXHandler.endElement = endElement;
|
xmlDefaultSAXHandler.endElement = endElement;
|
||||||
xmlDefaultSAXHandler.attribute = attribute;
|
xmlDefaultSAXHandler.reference = reference;
|
||||||
xmlDefaultSAXHandler.characters = characters;
|
xmlDefaultSAXHandler.characters = characters;
|
||||||
xmlDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
|
xmlDefaultSAXHandler.ignorableWhitespace = ignorableWhitespace;
|
||||||
xmlDefaultSAXHandler.processingInstruction = processingInstruction;
|
xmlDefaultSAXHandler.processingInstruction = processingInstruction;
|
||||||
|
xmlDefaultSAXHandler.comment = comment;
|
||||||
xmlDefaultSAXHandler.warning = xmlParserWarning;
|
xmlDefaultSAXHandler.warning = xmlParserWarning;
|
||||||
xmlDefaultSAXHandler.error = xmlParserError;
|
xmlDefaultSAXHandler.error = xmlParserError;
|
||||||
xmlDefaultSAXHandler.fatalError = xmlParserError;
|
xmlDefaultSAXHandler.fatalError = xmlParserError;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#ifndef __XML_ENTITIES_H__
|
#ifndef __XML_ENTITIES_H__
|
||||||
#define __XML_ENTITIES_H__
|
#define __XML_ENTITIES_H__
|
||||||
|
|
||||||
#include "parser.h"
|
#include "tree.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -56,6 +56,8 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr;
|
|||||||
* External functions :
|
* External functions :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
|
void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
|
||||||
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
|
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
|
||||||
void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
|
void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#ifndef __XML_ENTITIES_H__
|
#ifndef __XML_ENTITIES_H__
|
||||||
#define __XML_ENTITIES_H__
|
#define __XML_ENTITIES_H__
|
||||||
|
|
||||||
#include "parser.h"
|
#include "tree.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -56,6 +56,8 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr;
|
|||||||
* External functions :
|
* External functions :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
|
void xmlAddDocEntity(xmlDocPtr doc, const CHAR *name, int type,
|
||||||
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
|
const CHAR *ExternalID, const CHAR *SystemID, CHAR *content);
|
||||||
void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
|
void xmlAddDtdEntity(xmlDocPtr doc, const CHAR *name, int type,
|
||||||
|
@ -51,8 +51,12 @@ typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
|
|||||||
|
|
||||||
typedef struct _xmlParserCtxt {
|
typedef struct _xmlParserCtxt {
|
||||||
struct xmlSAXHandler *sax; /* The SAX handler */
|
struct xmlSAXHandler *sax; /* The SAX handler */
|
||||||
xmlDocPtr doc; /* the document being built */
|
void *userData; /* the document being built */
|
||||||
|
xmlDocPtr myDoc; /* the document being built */
|
||||||
int wellFormed; /* is the document well formed */
|
int wellFormed; /* is the document well formed */
|
||||||
|
const CHAR *version; /* the XML version string */
|
||||||
|
const CHAR *encoding; /* encoding, if any */
|
||||||
|
int standalone; /* standalone document */
|
||||||
|
|
||||||
/* Input stream stack */
|
/* Input stream stack */
|
||||||
xmlParserInputPtr input; /* Current input stream */
|
xmlParserInputPtr input; /* Current input stream */
|
||||||
@ -89,10 +93,24 @@ typedef xmlSAXLocator *xmlSAXLocatorPtr;
|
|||||||
* a SAX Exception.
|
* a SAX Exception.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "entities.h"
|
||||||
|
|
||||||
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *publicId, const CHAR *systemId);
|
const CHAR *publicId, const CHAR *systemId);
|
||||||
|
typedef void (*internalSubsetSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
const CHAR *ExternalID, const CHAR *SystemID);
|
||||||
|
typedef xmlEntityPtr (*getEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
|
const CHAR *name);
|
||||||
|
typedef void (*entityDeclSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
|
const CHAR *name, int type, const CHAR *publicId,
|
||||||
|
const CHAR *systemId, CHAR *content);
|
||||||
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
const CHAR *publicId, const CHAR *systemId);
|
const CHAR *publicId, const CHAR *systemId);
|
||||||
|
typedef void (*attributeDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *elem,
|
||||||
|
const CHAR *name, int type, int def,
|
||||||
|
const CHAR *defaultValue, xmlEnumerationPtr tree);
|
||||||
|
typedef void (*elementDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
int type, xmlElementContentPtr content);
|
||||||
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
|
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *name, const CHAR *publicId,
|
const CHAR *name, const CHAR *publicId,
|
||||||
const CHAR *systemId, const CHAR *notationName);
|
const CHAR *systemId, const CHAR *notationName);
|
||||||
@ -100,33 +118,48 @@ typedef void (*setDocumentLocatorSAXFunc) (xmlParserCtxtPtr ctxt,
|
|||||||
xmlSAXLocatorPtr loc);
|
xmlSAXLocatorPtr loc);
|
||||||
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
||||||
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
||||||
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
const CHAR **atts);
|
||||||
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
||||||
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
const CHAR *value);
|
const CHAR *value);
|
||||||
|
typedef void (*referenceSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
||||||
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
|
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
|
||||||
int start, int len);
|
int len);
|
||||||
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *ch, int start, int len);
|
const CHAR *ch, int len);
|
||||||
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *target, const CHAR *data);
|
const CHAR *target, const CHAR *data);
|
||||||
|
typedef void (*commentSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *value);
|
||||||
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
||||||
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
||||||
typedef void (*fatalErrorSAXFunc) (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 struct xmlSAXHandler {
|
typedef struct xmlSAXHandler {
|
||||||
|
internalSubsetSAXFunc internalSubset;
|
||||||
|
isStandaloneSAXFunc isStandalone;
|
||||||
|
hasInternalSubsetSAXFunc hasInternalSubset;
|
||||||
|
hasExternalSubsetSAXFunc hasExternalSubset;
|
||||||
resolveEntitySAXFunc resolveEntity;
|
resolveEntitySAXFunc resolveEntity;
|
||||||
|
getEntitySAXFunc getEntity;
|
||||||
|
entityDeclSAXFunc entityDecl;
|
||||||
notationDeclSAXFunc notationDecl;
|
notationDeclSAXFunc notationDecl;
|
||||||
|
attributeDeclSAXFunc attributeDecl;
|
||||||
|
elementDeclSAXFunc elementDecl;
|
||||||
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
||||||
setDocumentLocatorSAXFunc setDocumentLocator;
|
setDocumentLocatorSAXFunc setDocumentLocator;
|
||||||
startDocumentSAXFunc startDocument;
|
startDocumentSAXFunc startDocument;
|
||||||
endDocumentSAXFunc endDocument;
|
endDocumentSAXFunc endDocument;
|
||||||
startElementSAXFunc startElement;
|
startElementSAXFunc startElement;
|
||||||
endElementSAXFunc endElement;
|
endElementSAXFunc endElement;
|
||||||
attributeSAXFunc attribute;
|
referenceSAXFunc reference;
|
||||||
charactersSAXFunc characters;
|
charactersSAXFunc characters;
|
||||||
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
||||||
processingInstructionSAXFunc processingInstruction;
|
processingInstructionSAXFunc processingInstruction;
|
||||||
|
commentSAXFunc comment;
|
||||||
warningSAXFunc warning;
|
warningSAXFunc warning;
|
||||||
errorSAXFunc error;
|
errorSAXFunc error;
|
||||||
fatalErrorSAXFunc fatalError;
|
fatalErrorSAXFunc fatalError;
|
||||||
|
@ -529,6 +529,8 @@ xmlFreeInputStream(xmlParserInputPtr input);
|
|||||||
* Namespaces.
|
* Namespaces.
|
||||||
*/
|
*/
|
||||||
CHAR *
|
CHAR *
|
||||||
|
xmlSplitQName(const CHAR *name, CHAR **prefix);
|
||||||
|
CHAR *
|
||||||
xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt);
|
xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, CHAR **prefix);
|
xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, CHAR **prefix);
|
||||||
@ -558,7 +560,7 @@ void
|
|||||||
xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata);
|
xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict);
|
xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseComment(xmlParserCtxtPtr ctxt, int create);
|
xmlParseComment(xmlParserCtxtPtr ctxt, int create);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParsePITarget(xmlParserCtxtPtr ctxt);
|
xmlParsePITarget(xmlParserCtxtPtr ctxt);
|
||||||
@ -601,17 +603,17 @@ CHAR *
|
|||||||
xmlParsePEReference(xmlParserCtxtPtr ctxt);
|
xmlParsePEReference(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt);
|
xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt);
|
||||||
xmlAttrPtr
|
CHAR *
|
||||||
xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlNodePtr node);
|
xmlParseAttribute(xmlParserCtxtPtr ctxt, CHAR **value);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseStartTag(xmlParserCtxtPtr ctxt);
|
xmlParseStartTag(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseEndTag(xmlParserCtxtPtr ctxt, xmlNsPtr *nsPtr, CHAR **tagPtr);
|
xmlParseEndTag(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseCDSect(xmlParserCtxtPtr ctxt);
|
xmlParseCDSect(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseContent(xmlParserCtxtPtr ctxt);
|
xmlParseContent(xmlParserCtxtPtr ctxt);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseElement(xmlParserCtxtPtr ctxt);
|
xmlParseElement(xmlParserCtxtPtr ctxt);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParseVersionNum(xmlParserCtxtPtr ctxt);
|
xmlParseVersionNum(xmlParserCtxtPtr ctxt);
|
||||||
@ -628,5 +630,12 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt);
|
|||||||
void
|
void
|
||||||
xmlParseMisc(xmlParserCtxtPtr ctxt);
|
xmlParseMisc(xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP
|
||||||
|
*/
|
||||||
|
extern int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value);
|
||||||
|
extern xmlNodePtr nodePop(xmlParserCtxtPtr ctxt);
|
||||||
|
extern int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value);
|
||||||
|
extern xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
#endif /* __XML_PARSER_INTERNALS_H__ */
|
#endif /* __XML_PARSER_INTERNALS_H__ */
|
||||||
|
@ -283,8 +283,8 @@ xmlNodePtr xmlNewDocText(xmlDocPtr doc, const CHAR *content);
|
|||||||
xmlNodePtr xmlNewText(const CHAR *content);
|
xmlNodePtr xmlNewText(const CHAR *content);
|
||||||
xmlNodePtr xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len);
|
xmlNodePtr xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len);
|
||||||
xmlNodePtr xmlNewTextLen(const CHAR *content, int len);
|
xmlNodePtr xmlNewTextLen(const CHAR *content, int len);
|
||||||
xmlNodePtr xmlNewDocComment(xmlDocPtr doc, CHAR *content);
|
xmlNodePtr xmlNewDocComment(xmlDocPtr doc, const CHAR *content);
|
||||||
xmlNodePtr xmlNewComment(CHAR *content);
|
xmlNodePtr xmlNewComment(const CHAR *content);
|
||||||
xmlNodePtr xmlNewReference(xmlDocPtr doc, const CHAR *name);
|
xmlNodePtr xmlNewReference(xmlDocPtr doc, const CHAR *name);
|
||||||
xmlNodePtr xmlCopyNode(xmlNodePtr node, int recursive);
|
xmlNodePtr xmlCopyNode(xmlNodePtr node, int recursive);
|
||||||
xmlNodePtr xmlCopyNodeList(xmlNodePtr node);
|
xmlNodePtr xmlCopyNodeList(xmlNodePtr node);
|
||||||
|
@ -54,8 +54,8 @@ typedef struct xmlAttributeTable {
|
|||||||
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
||||||
|
|
||||||
/* Notation */
|
/* Notation */
|
||||||
xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, CHAR *name,
|
xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, const CHAR *name,
|
||||||
CHAR *PublicID, CHAR *SystemID);
|
const CHAR *PublicID, const CHAR *SystemID);
|
||||||
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
|
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
|
||||||
void xmlFreeNotationTable(xmlNotationTablePtr table);
|
void xmlFreeNotationTable(xmlNotationTablePtr table);
|
||||||
void xmlDumpNotationTable(xmlNotationTablePtr table);
|
void xmlDumpNotationTable(xmlNotationTablePtr table);
|
||||||
@ -66,7 +66,7 @@ xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
|
|||||||
void xmlFreeElementContent(xmlElementContentPtr cur);
|
void xmlFreeElementContent(xmlElementContentPtr cur);
|
||||||
|
|
||||||
/* Element */
|
/* Element */
|
||||||
xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, CHAR *name, int type,
|
xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, const CHAR *name, int type,
|
||||||
xmlElementContentPtr content);
|
xmlElementContentPtr content);
|
||||||
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
|
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
|
||||||
void xmlFreeElementTable(xmlElementTablePtr table);
|
void xmlFreeElementTable(xmlElementTablePtr table);
|
||||||
@ -78,9 +78,9 @@ void xmlFreeEnumeration(xmlEnumerationPtr cur);
|
|||||||
xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
|
xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
|
||||||
|
|
||||||
/* Attribute */
|
/* Attribute */
|
||||||
xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, CHAR *elem,
|
xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, const CHAR *elem,
|
||||||
CHAR *name, int type, int def,
|
const CHAR *name, int type, int def,
|
||||||
CHAR *defaultValue, xmlEnumerationPtr tree);
|
const CHAR *defaultValue, xmlEnumerationPtr tree);
|
||||||
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
|
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
|
||||||
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
|
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
|
||||||
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
|
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
|
||||||
|
43
parser.h
43
parser.h
@ -51,8 +51,12 @@ typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
|
|||||||
|
|
||||||
typedef struct _xmlParserCtxt {
|
typedef struct _xmlParserCtxt {
|
||||||
struct xmlSAXHandler *sax; /* The SAX handler */
|
struct xmlSAXHandler *sax; /* The SAX handler */
|
||||||
xmlDocPtr doc; /* the document being built */
|
void *userData; /* the document being built */
|
||||||
|
xmlDocPtr myDoc; /* the document being built */
|
||||||
int wellFormed; /* is the document well formed */
|
int wellFormed; /* is the document well formed */
|
||||||
|
const CHAR *version; /* the XML version string */
|
||||||
|
const CHAR *encoding; /* encoding, if any */
|
||||||
|
int standalone; /* standalone document */
|
||||||
|
|
||||||
/* Input stream stack */
|
/* Input stream stack */
|
||||||
xmlParserInputPtr input; /* Current input stream */
|
xmlParserInputPtr input; /* Current input stream */
|
||||||
@ -89,10 +93,24 @@ typedef xmlSAXLocator *xmlSAXLocatorPtr;
|
|||||||
* a SAX Exception.
|
* a SAX Exception.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "entities.h"
|
||||||
|
|
||||||
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *publicId, const CHAR *systemId);
|
const CHAR *publicId, const CHAR *systemId);
|
||||||
|
typedef void (*internalSubsetSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
const CHAR *ExternalID, const CHAR *SystemID);
|
||||||
|
typedef xmlEntityPtr (*getEntitySAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
|
const CHAR *name);
|
||||||
|
typedef void (*entityDeclSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
|
const CHAR *name, int type, const CHAR *publicId,
|
||||||
|
const CHAR *systemId, CHAR *content);
|
||||||
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
typedef void (*notationDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
const CHAR *publicId, const CHAR *systemId);
|
const CHAR *publicId, const CHAR *systemId);
|
||||||
|
typedef void (*attributeDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *elem,
|
||||||
|
const CHAR *name, int type, int def,
|
||||||
|
const CHAR *defaultValue, xmlEnumerationPtr tree);
|
||||||
|
typedef void (*elementDeclSAXFunc)(xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
int type, xmlElementContentPtr content);
|
||||||
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
|
typedef void (*unparsedEntityDeclSAXFunc)(xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *name, const CHAR *publicId,
|
const CHAR *name, const CHAR *publicId,
|
||||||
const CHAR *systemId, const CHAR *notationName);
|
const CHAR *systemId, const CHAR *notationName);
|
||||||
@ -100,33 +118,48 @@ typedef void (*setDocumentLocatorSAXFunc) (xmlParserCtxtPtr ctxt,
|
|||||||
xmlSAXLocatorPtr loc);
|
xmlSAXLocatorPtr loc);
|
||||||
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
typedef void (*startDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
||||||
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
typedef void (*endDocumentSAXFunc) (xmlParserCtxtPtr ctxt);
|
||||||
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
typedef void (*startElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
|
const CHAR **atts);
|
||||||
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
typedef void (*endElementSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
||||||
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
typedef void (*attributeSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name,
|
||||||
const CHAR *value);
|
const CHAR *value);
|
||||||
|
typedef void (*referenceSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *name);
|
||||||
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
|
typedef void (*charactersSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *ch,
|
||||||
int start, int len);
|
int len);
|
||||||
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef void (*ignorableWhitespaceSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *ch, int start, int len);
|
const CHAR *ch, int len);
|
||||||
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
|
typedef void (*processingInstructionSAXFunc) (xmlParserCtxtPtr ctxt,
|
||||||
const CHAR *target, const CHAR *data);
|
const CHAR *target, const CHAR *data);
|
||||||
|
typedef void (*commentSAXFunc) (xmlParserCtxtPtr ctxt, const CHAR *value);
|
||||||
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
typedef void (*warningSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
||||||
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
typedef void (*errorSAXFunc) (xmlParserCtxtPtr ctxt, const char *msg, ...);
|
||||||
typedef void (*fatalErrorSAXFunc) (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 struct xmlSAXHandler {
|
typedef struct xmlSAXHandler {
|
||||||
|
internalSubsetSAXFunc internalSubset;
|
||||||
|
isStandaloneSAXFunc isStandalone;
|
||||||
|
hasInternalSubsetSAXFunc hasInternalSubset;
|
||||||
|
hasExternalSubsetSAXFunc hasExternalSubset;
|
||||||
resolveEntitySAXFunc resolveEntity;
|
resolveEntitySAXFunc resolveEntity;
|
||||||
|
getEntitySAXFunc getEntity;
|
||||||
|
entityDeclSAXFunc entityDecl;
|
||||||
notationDeclSAXFunc notationDecl;
|
notationDeclSAXFunc notationDecl;
|
||||||
|
attributeDeclSAXFunc attributeDecl;
|
||||||
|
elementDeclSAXFunc elementDecl;
|
||||||
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
||||||
setDocumentLocatorSAXFunc setDocumentLocator;
|
setDocumentLocatorSAXFunc setDocumentLocator;
|
||||||
startDocumentSAXFunc startDocument;
|
startDocumentSAXFunc startDocument;
|
||||||
endDocumentSAXFunc endDocument;
|
endDocumentSAXFunc endDocument;
|
||||||
startElementSAXFunc startElement;
|
startElementSAXFunc startElement;
|
||||||
endElementSAXFunc endElement;
|
endElementSAXFunc endElement;
|
||||||
attributeSAXFunc attribute;
|
referenceSAXFunc reference;
|
||||||
charactersSAXFunc characters;
|
charactersSAXFunc characters;
|
||||||
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
||||||
processingInstructionSAXFunc processingInstruction;
|
processingInstructionSAXFunc processingInstruction;
|
||||||
|
commentSAXFunc comment;
|
||||||
warningSAXFunc warning;
|
warningSAXFunc warning;
|
||||||
errorSAXFunc error;
|
errorSAXFunc error;
|
||||||
fatalErrorSAXFunc fatalError;
|
fatalErrorSAXFunc fatalError;
|
||||||
|
@ -529,6 +529,8 @@ xmlFreeInputStream(xmlParserInputPtr input);
|
|||||||
* Namespaces.
|
* Namespaces.
|
||||||
*/
|
*/
|
||||||
CHAR *
|
CHAR *
|
||||||
|
xmlSplitQName(const CHAR *name, CHAR **prefix);
|
||||||
|
CHAR *
|
||||||
xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt);
|
xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, CHAR **prefix);
|
xmlNamespaceParseQName(xmlParserCtxtPtr ctxt, CHAR **prefix);
|
||||||
@ -558,7 +560,7 @@ void
|
|||||||
xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata);
|
xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict);
|
xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseComment(xmlParserCtxtPtr ctxt, int create);
|
xmlParseComment(xmlParserCtxtPtr ctxt, int create);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParsePITarget(xmlParserCtxtPtr ctxt);
|
xmlParsePITarget(xmlParserCtxtPtr ctxt);
|
||||||
@ -601,17 +603,17 @@ CHAR *
|
|||||||
xmlParsePEReference(xmlParserCtxtPtr ctxt);
|
xmlParsePEReference(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt);
|
xmlParseDocTypeDecl(xmlParserCtxtPtr ctxt);
|
||||||
xmlAttrPtr
|
CHAR *
|
||||||
xmlParseAttribute(xmlParserCtxtPtr ctxt, xmlNodePtr node);
|
xmlParseAttribute(xmlParserCtxtPtr ctxt, CHAR **value);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseStartTag(xmlParserCtxtPtr ctxt);
|
xmlParseStartTag(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseEndTag(xmlParserCtxtPtr ctxt, xmlNsPtr *nsPtr, CHAR **tagPtr);
|
xmlParseEndTag(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseCDSect(xmlParserCtxtPtr ctxt);
|
xmlParseCDSect(xmlParserCtxtPtr ctxt);
|
||||||
void
|
void
|
||||||
xmlParseContent(xmlParserCtxtPtr ctxt);
|
xmlParseContent(xmlParserCtxtPtr ctxt);
|
||||||
xmlNodePtr
|
void
|
||||||
xmlParseElement(xmlParserCtxtPtr ctxt);
|
xmlParseElement(xmlParserCtxtPtr ctxt);
|
||||||
CHAR *
|
CHAR *
|
||||||
xmlParseVersionNum(xmlParserCtxtPtr ctxt);
|
xmlParseVersionNum(xmlParserCtxtPtr ctxt);
|
||||||
@ -628,5 +630,12 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt);
|
|||||||
void
|
void
|
||||||
xmlParseMisc(xmlParserCtxtPtr ctxt);
|
xmlParseMisc(xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP
|
||||||
|
*/
|
||||||
|
extern int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value);
|
||||||
|
extern xmlNodePtr nodePop(xmlParserCtxtPtr ctxt);
|
||||||
|
extern int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value);
|
||||||
|
extern xmlParserInputPtr inputPop(xmlParserCtxtPtr ctxt);
|
||||||
|
|
||||||
#endif /* __XML_PARSER_INTERNALS_H__ */
|
#endif /* __XML_PARSER_INTERNALS_H__ */
|
||||||
|
4
tree.c
4
tree.c
@ -1088,7 +1088,7 @@ xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len) {
|
|||||||
* Returns a pointer to the new node object.
|
* Returns a pointer to the new node object.
|
||||||
*/
|
*/
|
||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlNewComment(CHAR *content) {
|
xmlNewComment(const CHAR *content) {
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1128,7 +1128,7 @@ xmlNewComment(CHAR *content) {
|
|||||||
* Returns a pointer to the new node object.
|
* Returns a pointer to the new node object.
|
||||||
*/
|
*/
|
||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlNewDocComment(xmlDocPtr doc, CHAR *content) {
|
xmlNewDocComment(xmlDocPtr doc, const CHAR *content) {
|
||||||
xmlNodePtr cur;
|
xmlNodePtr cur;
|
||||||
|
|
||||||
cur = xmlNewComment(content);
|
cur = xmlNewComment(content);
|
||||||
|
4
tree.h
4
tree.h
@ -283,8 +283,8 @@ xmlNodePtr xmlNewDocText(xmlDocPtr doc, const CHAR *content);
|
|||||||
xmlNodePtr xmlNewText(const CHAR *content);
|
xmlNodePtr xmlNewText(const CHAR *content);
|
||||||
xmlNodePtr xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len);
|
xmlNodePtr xmlNewDocTextLen(xmlDocPtr doc, const CHAR *content, int len);
|
||||||
xmlNodePtr xmlNewTextLen(const CHAR *content, int len);
|
xmlNodePtr xmlNewTextLen(const CHAR *content, int len);
|
||||||
xmlNodePtr xmlNewDocComment(xmlDocPtr doc, CHAR *content);
|
xmlNodePtr xmlNewDocComment(xmlDocPtr doc, const CHAR *content);
|
||||||
xmlNodePtr xmlNewComment(CHAR *content);
|
xmlNodePtr xmlNewComment(const CHAR *content);
|
||||||
xmlNodePtr xmlNewReference(xmlDocPtr doc, const CHAR *name);
|
xmlNodePtr xmlNewReference(xmlDocPtr doc, const CHAR *name);
|
||||||
xmlNodePtr xmlCopyNode(xmlNodePtr node, int recursive);
|
xmlNodePtr xmlCopyNode(xmlNodePtr node, int recursive);
|
||||||
xmlNodePtr xmlCopyNodeList(xmlNodePtr node);
|
xmlNodePtr xmlCopyNodeList(xmlNodePtr node);
|
||||||
|
10
valid.c
10
valid.c
@ -216,7 +216,7 @@ xmlCreateElementTable(void) {
|
|||||||
* Returns NULL if not, othervise the entity
|
* Returns NULL if not, othervise the entity
|
||||||
*/
|
*/
|
||||||
xmlElementPtr
|
xmlElementPtr
|
||||||
xmlAddElementDecl(xmlDtdPtr dtd, CHAR *name, int type,
|
xmlAddElementDecl(xmlDtdPtr dtd, const CHAR *name, int type,
|
||||||
xmlElementContentPtr content) {
|
xmlElementContentPtr content) {
|
||||||
xmlElementPtr ret, cur;
|
xmlElementPtr ret, cur;
|
||||||
xmlElementTablePtr table;
|
xmlElementTablePtr table;
|
||||||
@ -560,8 +560,9 @@ xmlCreateAttributeTable(void) {
|
|||||||
* Returns NULL if not, othervise the entity
|
* Returns NULL if not, othervise the entity
|
||||||
*/
|
*/
|
||||||
xmlAttributePtr
|
xmlAttributePtr
|
||||||
xmlAddAttributeDecl(xmlDtdPtr dtd, CHAR *elem, CHAR *name, int type, int def,
|
xmlAddAttributeDecl(xmlDtdPtr dtd, const CHAR *elem, const CHAR *name,
|
||||||
CHAR *defaultValue, xmlEnumerationPtr tree) {
|
int type, int def, const CHAR *defaultValue,
|
||||||
|
xmlEnumerationPtr tree) {
|
||||||
xmlAttributePtr ret, cur;
|
xmlAttributePtr ret, cur;
|
||||||
xmlAttributeTablePtr table;
|
xmlAttributeTablePtr table;
|
||||||
int i;
|
int i;
|
||||||
@ -890,7 +891,8 @@ xmlCreateNotationTable(void) {
|
|||||||
* Returns NULL if not, othervise the entity
|
* Returns NULL if not, othervise the entity
|
||||||
*/
|
*/
|
||||||
xmlNotationPtr
|
xmlNotationPtr
|
||||||
xmlAddNotationDecl(xmlDtdPtr dtd, CHAR *name, CHAR *PublicID, CHAR *SystemID) {
|
xmlAddNotationDecl(xmlDtdPtr dtd, const CHAR *name, const CHAR *PublicID,
|
||||||
|
const CHAR *SystemID) {
|
||||||
xmlNotationPtr ret, cur;
|
xmlNotationPtr ret, cur;
|
||||||
xmlNotationTablePtr table;
|
xmlNotationTablePtr table;
|
||||||
int i;
|
int i;
|
||||||
|
12
valid.h
12
valid.h
@ -54,8 +54,8 @@ typedef struct xmlAttributeTable {
|
|||||||
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
typedef xmlAttributeTable *xmlAttributeTablePtr;
|
||||||
|
|
||||||
/* Notation */
|
/* Notation */
|
||||||
xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, CHAR *name,
|
xmlNotationPtr xmlAddNotationDecl(xmlDtdPtr dtd, const CHAR *name,
|
||||||
CHAR *PublicID, CHAR *SystemID);
|
const CHAR *PublicID, const CHAR *SystemID);
|
||||||
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
|
xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
|
||||||
void xmlFreeNotationTable(xmlNotationTablePtr table);
|
void xmlFreeNotationTable(xmlNotationTablePtr table);
|
||||||
void xmlDumpNotationTable(xmlNotationTablePtr table);
|
void xmlDumpNotationTable(xmlNotationTablePtr table);
|
||||||
@ -66,7 +66,7 @@ xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
|
|||||||
void xmlFreeElementContent(xmlElementContentPtr cur);
|
void xmlFreeElementContent(xmlElementContentPtr cur);
|
||||||
|
|
||||||
/* Element */
|
/* Element */
|
||||||
xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, CHAR *name, int type,
|
xmlElementPtr xmlAddElementDecl(xmlDtdPtr dtd, const CHAR *name, int type,
|
||||||
xmlElementContentPtr content);
|
xmlElementContentPtr content);
|
||||||
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
|
xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table);
|
||||||
void xmlFreeElementTable(xmlElementTablePtr table);
|
void xmlFreeElementTable(xmlElementTablePtr table);
|
||||||
@ -78,9 +78,9 @@ void xmlFreeEnumeration(xmlEnumerationPtr cur);
|
|||||||
xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
|
xmlEnumerationPtr xmlCopyEnumeration(xmlEnumerationPtr cur);
|
||||||
|
|
||||||
/* Attribute */
|
/* Attribute */
|
||||||
xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, CHAR *elem,
|
xmlAttributePtr xmlAddAttributeDecl(xmlDtdPtr dtd, const CHAR *elem,
|
||||||
CHAR *name, int type, int def,
|
const CHAR *name, int type, int def,
|
||||||
CHAR *defaultValue, xmlEnumerationPtr tree);
|
const CHAR *defaultValue, xmlEnumerationPtr tree);
|
||||||
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
|
xmlAttributeTablePtr xmlCopyAttributeTable(xmlAttributeTablePtr table);
|
||||||
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
|
void xmlFreeAttributeTable(xmlAttributeTablePtr table);
|
||||||
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
|
void xmlDumpAttributeTable(xmlAttributeTablePtr table);
|
||||||
|
Reference in New Issue
Block a user