SAX2.c revision 38ae7e4efe803ea78b6499cd05a394db32623e41
/*
* SAX2.c : Default SAX2 handler to build a tree.
*
* See Copyright for the status of this software.
*
* Daniel Veillard <daniel@veillard.com>
*/
#define IN_LIBXML
#include "libxml.h"
#include <stdlib.h>
#include <string.h>
#include <libxml/xmlmemory.h>
#include <libxml/parserInternals.h>
#include <libxml/entities.h>
#include <libxml/xmlerror.h>
#include <libxml/debugXML.h>
#include <libxml/HTMLtree.h>
/* #define DEBUG_SAX2 */
/* #define DEBUG_SAX2_TREE */
/**
* TODO:
*
* macro to flag unimplemented blocks
* option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk>
*> Just FYI, I am using an environment variable XML_CATALOG_PREFER with
*> values "system" and "public". I have made the default be "system" to
*> match yours.
*/
#define TODO \
"Unimplemented block at %s:%d\n", \
/*
* xmlSAX2ErrMemory:
* @ctxt: an XML validation parser context
* @msg: a string to accompany the error message
*/
static void
}
}
/**
* xmlValidError:
* @ctxt: an XML validation parser context
* @error: the error number
* @msg: the error message
* @str1: extra data
* @str2: extra data
*
* Handle a validation error
*/
static void
{
return;
} else {
}
}
/**
* xmlFatalErrMsg:
* @ctxt: an XML parser context
* @error: the error number
* @msg: the error message
* @str1: an error string
* @str2: an error string
*
* Handle a fatal parser error, i.e. violating Well-Formedness constraints
*/
static void
{
return;
XML_ERR_FATAL, NULL, 0,
ctxt->wellFormed = 0;
}
}
/**
* xmlWarnMsg:
* @ctxt: an XML parser context
* @error: the error number
* @msg: the error message
* @str1: an error string
* @str2: an error string
*
* Handle a parser warning
*/
static void
{
return;
XML_ERR_WARNING, NULL, 0,
}
/**
* xmlNsErrMsg:
* @ctxt: an XML parser context
* @error: the error number
* @msg: the error message
* @str1: an error string
* @str2: an error string
*
* Handle a namespace error
*/
static void
{
return;
XML_ERR_ERROR, NULL, 0,
}
/**
* xmlNsWarnMsg:
* @ctxt: an XML parser context
* @error: the error number
* @msg: the error message
* @str1: an error string
*
* Handle a namespace warning
*/
static void
{
return;
XML_ERR_WARNING, NULL, 0,
}
/**
* xmlSAX2GetPublicId:
* @ctx: the user data (XML parser context)
*
* Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
*
* Returns a xmlChar *
*/
const xmlChar *
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
return(NULL);
}
/**
* xmlSAX2GetSystemId:
* @ctx: the user data (XML parser context)
*
* Provides the system ID, basically URL or filename e.g.
*
* Returns a xmlChar *
*/
const xmlChar *
xmlSAX2GetSystemId(void *ctx)
{
}
/**
* xmlSAX2GetLineNumber:
* @ctx: the user data (XML parser context)
*
* Provide the line number of the current parsing point.
*
* Returns an int
*/
int
xmlSAX2GetLineNumber(void *ctx)
{
}
/**
* xmlSAX2GetColumnNumber:
* @ctx: the user data (XML parser context)
*
* Provide the column number of the current parsing point.
*
* Returns an int
*/
int
xmlSAX2GetColumnNumber(void *ctx)
{
}
/**
* xmlSAX2IsStandalone:
* @ctx: the user data (XML parser context)
*
* Is this document tagged standalone ?
*
* Returns 1 if true
*/
int
xmlSAX2IsStandalone(void *ctx)
{
}
/**
* xmlSAX2HasInternalSubset:
* @ctx: the user data (XML parser context)
*
* Does this document has an internal subset
*
* Returns 1 if true
*/
int
xmlSAX2HasInternalSubset(void *ctx)
{
}
/**
* xmlSAX2HasExternalSubset:
* @ctx: the user data (XML parser context)
*
* Does this document has an external subset
*
* Returns 1 if true
*/
int
xmlSAX2HasExternalSubset(void *ctx)
{
}
/**
* xmlSAX2InternalSubset:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on internal subset declaration.
*/
void
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2InternalSubset(%s, %s, %s)\n",
#endif
return;
return;
}
}
/**
* xmlSAX2ExternalSubset:
* @ctx: the user data (XML parser context)
* @name: the root element name
* @ExternalID: the external ID
* @SystemID: the SYSTEM ID (e.g. filename or URL)
*
* Callback on external subset declaration.
*/
void
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2ExternalSubset(%s, %s, %s)\n",
#endif
/*
* Try to fetch and parse the external subset.
*/
int oldinputNr;
int oldinputMax;
int oldcharset;
/*
* Ask the Entity resolver to load the damn thing
*/
SystemID);
return;
}
/*
* make sure we won't destroy the main document context
*/
return;
}
/*
* On the fly encoding conversion if needed
*/
}
/*
* let's parse that entity knowing it's an external subset.
*/
/*
* Free up the external entities
*/
/*
* Restore the parsing context of the main entity
*/
/* ctxt->wellFormed = oldwellFormed; */
}
}
/**
* xmlSAX2ResolveEntity:
* @ctx: the user data (XML parser context)
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* The entity loader, to control the loading of external entities,
* the application can either:
* - override this xmlSAX2ResolveEntity() callback in the SAX block
* - or better use the xmlSetExternalEntityLoader() function to
* set up it's own entity resolution routine
*
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
*/
{
#ifdef DEBUG_SAX
#endif
return(ret);
}
/**
* xmlSAX2GetEntity:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get an entity by name
*
* Returns the xmlEntityPtr if found.
*/
{
#ifdef DEBUG_SAX
#endif
return(ret);
}
} else {
"Entity(%s) document marked standalone but requires external subset\n",
}
}
}
} else {
}
int val;
/*
* for validation purposes we really need to fetch and
* parse the external entity
*/
if (val == 0) {
} else {
return(NULL);
}
}
return(ret);
}
/**
* xmlSAX2GetParameterEntity:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* Get a parameter entity by name
*
* Returns the xmlEntityPtr if found.
*/
{
#ifdef DEBUG_SAX
#endif
return(ret);
}
/**
* xmlSAX2EntityDecl:
* @ctx: the user data (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
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2EntityDecl(%s, %d, %s, %s, %s)\n",
#endif
"Entity(%s) already defined in the internal subset\n",
name);
}
"Entity(%s) already defined in the external subset\n", name);
}
} else {
"SAX.xmlSAX2EntityDecl(%s) called while not in subset\n",
}
}
/**
* xmlSAX2AttributeDecl:
* @ctx: the user data (XML parser context)
* @elem: the name of the element
* @fullname: the attribute name
* @type: the attribute type
* @def: the type of default value
* @defaultValue: the attribute default value
* @tree: the tree of enumerated value set
*
* An attribute definition has been parsed
*/
void
{
return;
#ifdef DEBUG_SAX
"SAX.xmlSAX2AttributeDecl(%s, %s, %d, %d, %s, ...)\n",
#endif
(type != XML_ATTRIBUTE_ID)) {
/*
* Raise the error but keep the validity flag
*/
}
else {
"SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n",
return;
}
#ifdef LIBXML_VALID_ENABLED
attr);
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlSAX2ElementDecl:
* @ctx: the user data (XML parser context)
* @name: the element name
* @type: the element type
* @content: the element value tree
*
* An element definition has been parsed
*/
void
{
return;
#ifdef DEBUG_SAX
#endif
else {
"SAX.xmlSAX2ElementDecl(%s) called while not in subset\n",
return;
}
#ifdef LIBXML_VALID_ENABLED
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlSAX2NotationDecl:
* @ctx: the user data (XML parser context)
* @name: The name of the notation
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
*
* What to do when a notation declaration has been parsed.
*/
void
{
return;
#ifdef DEBUG_SAX
#endif
"SAX.xmlSAX2NotationDecl(%s) externalID or PublicID missing\n",
return;
else {
"SAX.xmlSAX2NotationDecl(%s) called while not in subset\n",
return;
}
#ifdef LIBXML_VALID_ENABLED
nota);
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlSAX2UnparsedEntityDecl:
* @ctx: the user data (XML parser context)
* @name: The name of the entity
* @publicId: The public ID of the entity
* @systemId: The system ID of the entity
* @notationName: the name of the notation
*
* What to do when an unparsed entity declaration is parsed
*/
void
const xmlChar *notationName)
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n",
#endif
"Entity(%s) already defined in the internal subset\n", name);
}
"Entity(%s) already defined in the external subset\n", name);
}
} else {
"SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n",
}
}
/**
* xmlSAX2SetDocumentLocator:
* @ctx: the user data (XML parser context)
* @loc: A SAX Locator
*
* Receive the document locator at startup, actually xmlDefaultSAXLocator
* Everything is available on the context, so this is useless in our case.
*/
void
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
"SAX.xmlSAX2SetDocumentLocator()\n");
#endif
}
/**
* xmlSAX2StartDocument:
* @ctx: the user data (XML parser context)
*
* called when the document start being processed.
*/
void
xmlSAX2StartDocument(void *ctx)
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2StartDocument()\n");
#endif
#ifdef LIBXML_HTML_ENABLED
return;
}
#else
"libxml2 built without HTML support\n");
return;
#endif
} else {
else
} else {
return;
}
}
}
}
}
/**
* xmlSAX2EndDocument:
* @ctx: the user data (XML parser context)
*
* called when the document end has been detected.
*/
void
xmlSAX2EndDocument(void *ctx)
{
#ifdef DEBUG_SAX
"SAX.xmlSAX2EndDocument()\n");
#endif
#ifdef LIBXML_VALID_ENABLED
#endif /* LIBXML_VALID_ENABLED */
/*
* Grab the encoding if it was added on-the-fly
*/
}
}
}
}
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
/**
* xmlSAX2AttributeInternal:
* @ctx: the user data (XML parser context)
* @fullname: The attribute name, including namespace prefix
* @value: The attribute value
* @prefix: the prefix on the element node
*
* 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.
*/
static void
{
} else {
/*
* Split the full name into a namespace prefix and the tag name
*/
"invalid namespace declaration '%s'\n",
} else {
"Avoid attribute ending with ':' like '%s'\n",
}
}
}
return;
}
#ifdef LIBXML_VALID_ENABLED
/*
* Do the last stage of the attribute normalization
* Needed for HTML too:
*/
}
#else
#endif /* LIBXML_VALID_ENABLED */
/*
* Check whether it's a namespace definition
*/
if (!ctxt->replaceEntities) {
0,0,0);
} else {
}
if (val[0] != 0) {
"xmlns: %s not a valid URI\n", val);
} else {
"xmlns: URI %s is not absolute\n", val);
}
}
}
/* a default namespace definition */
#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
*/
#endif /* LIBXML_VALID_ENABLED */
return;
}
if (!ctxt->replaceEntities) {
0,0,0);
return;
}
} else {
}
if (val[0] == 0) {
}
} else {
}
}
}
/* a standard namespace definition */
#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
*/
#endif /* LIBXML_VALID_ENABLED */
return;
}
"Namespace prefix %s of attribute %s is not defined\n",
}
"Attribute %s in %s redefined\n",
ctxt->wellFormed = 0;
goto error;
}
}
}
} else {
}
/* !!!!!! <a toto:arg="" xmlns:toto="http://toto.com"> */
}
}
}
#ifdef LIBXML_VALID_ENABLED
/*
* If we don't substitute entities, the validation should be
* done on a value with replaced entities anyway.
*/
if (!ctxt->replaceEntities) {
0,0,0);
else {
/*
* Do the last stage of the attribute normalization
* It need to be done twice ... it's an extra burden related
* to the ability to keep xmlSAX2References in attributes
*/
}
}
} else {
}
} else
#endif /* LIBXML_VALID_ENABLED */
/*
* when validating, the ID registration is done at the attribute
* validation level. Otherwise we have to do specific handling here.
*/
/*
* Add the xml:id value
*
* Open issue: normalization of the value.
*/
"xml:id : attribute value %s is not an NCName\n",
}
}
}
/*
* xmlCheckDefaultedAttributes:
*
* Check defaulted attributes from the DTD
*/
static void
int internal = 1;
int i;
internal = 0;
}
/*
* Check against defaulted attributes from the external subset
* if the document is stamped as standalone
*/
} else {
}
/*
* Check that the attribute is not declared in the
* serialization
*/
i = 0;
break;
i += 2;
}
}
"standalone: attribute %s on %s defaulted from external subset\n",
(const char *)fulln,
}
}
}
}
/*
* Actually insert defaulted values when needed
*/
/*
* Make sure that attributes redefinition occuring in the
* internal subset are not overriden by definitions in the
* external subset.
*/
/*
* the element should be instantiated in the tree if:
* - this is a namespace prefix
* - the user required for completion in the tree
* like XSLT
* - there isn't already an attribute definition
* in the internal subset overriding it.
*/
return;
}
/*
* Check that the attribute is not declared in the
* serialization
*/
i = 0;
break;
i += 2;
}
}
}
}
}
}
}
if (internal == 1) {
internal = 0;
goto process_external_subset;
}
}
}
/**
* xmlSAX2StartElement:
* @ctx: the user data (XML parser context)
* @fullname: The element name, including namespace prefix
*
* called when an opening tag has been processed.
*/
void
{
int i;
#ifdef DEBUG_SAX
#endif
/*
* First check on validity:
*/
}
/*
* Split the full name into a namespace prefix and the tag name
*/
/*
* 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.
*/
return;
}
#ifdef DEBUG_SAX_TREE
#endif
}
if (ctxt->linenumbers) {
else
}
}
/*
* We are parsing a new node.
*/
#ifdef DEBUG_SAX_TREE
#endif
/*
* Link the child element
*/
#ifdef DEBUG_SAX_TREE
#endif
} else {
#ifdef DEBUG_SAX_TREE
"adding sibling %s to ", name);
#endif
}
}
/*
* Insert all the defaulted attributes from the DTD especially namespaces
*/
}
/*
* process all the attributes whose name start with "xmlns"
*/
i = 0;
}
}
}
/*
* Search the namespace, note that since the attributes have been
* processed, the local namespaces are available.
*/
"Namespace prefix %s is not defined\n",
}
/*
* set the namespace node, making sure that if the default namspace
* is unbound on a parent we simply kee it NULL
*/
/*
* process all the other attributes
*/
i = 0;
}
} else {
/*
* Next ones
*/
}
}
}
#ifdef LIBXML_VALID_ENABLED
/*
* If it's the Document root, finish the DTD validation and
* check the document root element for validity
*/
int chk;
if (chk <= 0)
if (chk < 0)
ctxt->wellFormed = 0;
}
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlSAX2EndElement:
* @ctx: the user data (XML parser context)
* @name: The element name
*
* called when the end of an element has been detected.
*/
void
{
#ifdef DEBUG_SAX
else
#endif
/* Capture end position and add node */
}
#ifdef LIBXML_VALID_ENABLED
cur);
#endif /* LIBXML_VALID_ENABLED */
/*
* end of parsing of this node.
*/
#ifdef DEBUG_SAX_TREE
#endif
}
#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLE */
/*
* xmlSAX2TextNode:
* @ctxt: the parser context
* @str: the input string
* @len: the string length
*
* Remove the entities from an attribute value
*
* Returns the newly allocated string or NULL if not needed or error
*/
static xmlNodePtr
/*
* Allocate
*/
ctxt->freeElemsNr--;
} else {
}
return(NULL);
}
/*
* intern the formatting blanks found between tags, or the
* very short strings
*/
if ((len < (int) (2 * sizeof(void *))) &&
/* store the string in the node overrithing properties and nsDef */
int i;
for (i = 1;i < len;i++) {
}
}
}
skip:
return(NULL);
}
} else
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
return(ret);
}
#ifdef LIBXML_VALID_ENABLED
/*
* xmlSAX2DecodeAttrEntities:
* @ctxt: the parser context
* @str: the input string
* @len: the string length
*
* Remove the entities from an attribute value
*
* Returns the newly allocated string or NULL if not needed or error
*/
static xmlChar *
if (*in++ == '&')
goto decode;
return(NULL);
XML_SUBSTITUTE_REF, 0,0,0);
return(ret);
}
#endif /* LIBXML_VALID_ENABLED */
/**
* xmlSAX2AttributeNs:
* @ctx: the user data (XML parser context)
* @localname: the local name of the attribute
* @prefix: the attribute namespace prefix if available
* @URI: the attribute namespace name if available
* @value: Start of the attribute value
* @valueend: end of 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.
*/
static void
{
/*
* Note: if prefix == NULL, the attribute is not in the default namespace
*/
/*
* allocate the node
*/
ctxt->freeAttrsNr--;
else
/* link at the end to preserv order, TODO speed up with a last */
} else {
}
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
} else {
else
return;
}
}
/*
* We know that if there is an entity reference, then
* the string has been dup'ed and terminates with 0
* otherwise with ' or "
*/
if (*valueend != 0) {
}
} else {
}
}
}
}
#ifdef LIBXML_VALID_ENABLED
/*
* If we don't substitute entities, the validation should be
* done on a value with replaced entities anyway.
*/
if (!ctxt->replaceEntities) {
if (*valueend == 0) {
} else {
/*
* That should already be normalized.
* cheaper to finally allocate here than duplicate
* entry points in the full validation code
*/
}
} else {
/*
* dup now contains a string of the flattened attribute
* content with entities substitued. Check if we need to
* apply an extra layer of normalization.
* It need to be done twice ... it's an extra burden related
* to the ability to keep references in attributes
*/
}
}
}
}
} else {
/*
* if entities already have been substitued, then
* the attribute as passed is already normalized
*/
}
} else
#endif /* LIBXML_VALID_ENABLED */
/*
* when validating, the ID registration is done at the attribute
* validation level. Otherwise we have to do specific handling here.
*/
(localname[2] == 0)) {
/*
* Add the xml:id value
*
* Open issue: normalization of the value.
*/
#ifdef LIBXML_VALID_ENABLED
"xml:id : attribute value %s is not an NCName\n",
}
#endif
/* might be worth duplicate entry points and not copy */
}
}
}
/**
* xmlSAX2StartElementNs:
* @ctx: the user data (XML parser context)
* @localname: the local name of the element
* @prefix: the element namespace prefix if available
* @URI: the element namespace name if available
* @nb_namespaces: number of namespace definitions on that node
* @nb_attributes: the number of attributes on that node
* @nb_defaulted: the number of defaulted attributes.
* attribute values.
*
* SAX2 callback when an element start has been detected by the parser.
* It provides the namespace informations for the element, as well as
* the new namespace declarations on the element.
*/
void
xmlSAX2StartElementNs(void *ctx,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes)
{
int i, j;
/*
* First check on validity:
*/
}
/*
* allocate the node
*/
ctxt->freeElemsNr--;
else {
return;
}
}
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
} else {
else
return;
}
}
if (ctxt->linenumbers) {
else
}
}
}
/*
* Build the namespace list
*/
for (i = 0,j = 0;j < nb_namespaces;j++) {
pref = namespaces[i++];
uri = namespaces[i++];
} else {
}
} else {
return;
}
#ifdef LIBXML_VALID_ENABLED
}
#endif /* LIBXML_VALID_ENABLED */
}
/*
* We are parsing a new node.
*/
/*
* Link the child element
*/
} else {
}
}
/*
* Insert the defaulted attributes from the DTD only if requested:
*/
if ((nb_defaulted != 0) &&
/*
* Search the namespace if it wasn't already found
* Note that, if prefix is NULL, this searches for the default Ns
*/
}
return;
}
"Namespace prefix %s was not found\n",
}
}
/*
* process all the other attributes
*/
if (nb_attributes > 0) {
for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
}
}
#ifdef LIBXML_VALID_ENABLED
/*
* If it's the Document root, finish the DTD validation and
* check the document root element for validity
*/
int chk;
if (chk <= 0)
if (chk < 0)
ctxt->wellFormed = 0;
}
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlSAX2EndElementNs:
* @ctx: the user data (XML parser context)
* @localname: the local name of the element
* @prefix: the element namespace prefix if available
* @URI: the element namespace name if available
*
* SAX2 callback when an element end has been detected by the parser.
* It provides the namespace informations for the element.
*/
void
xmlSAX2EndElementNs(void *ctx,
{
/* Capture end position and add node */
}
#ifdef LIBXML_VALID_ENABLED
#endif /* LIBXML_VALID_ENABLED */
/*
* end of parsing of this node.
*/
}
/**
* xmlSAX2Reference:
* @ctx: the user data (XML parser context)
* @name: The entity name
*
* called when an entity xmlSAX2Reference is detected.
*/
void
{
#ifdef DEBUG_SAX
#endif
if (name[0] == '#')
else
#ifdef DEBUG_SAX_TREE
#endif
}
/**
* xmlSAX2Characters:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* receiving some chars from the parser.
*/
void
{
#ifdef DEBUG_SAX
#endif
/*
* Handle the data if any. If there is no child
* add it as content, otherwise if the last child is text,
* concatenate it, else create a new node of type text.
*/
#ifdef DEBUG_SAX_TREE
"add chars: ctxt->node == NULL !\n");
#endif
return;
}
#ifdef DEBUG_SAX_TREE
#endif
/*
* Here we needed an accelerator mechanism in case of very large
* elements. Use an attribute in the structure !!!
*/
} else {
return;
}
} else {
/*
* The whole point of maintaining nodelen and nodemem,
* xmlTextConcat is too costly, i.e. compute length,
* reallocate a new buffer, move data, append ch. Here
* We try to minimaze realloc() uses and avoid copying
* and recomputing length over and over.
*/
}
int size;
size *= 2;
return;
}
}
} else if (coalesceText) {
}
}
} else {
/* Mixed content, first time */
}
}
}
}
}
/**
* xmlSAX2IgnorableWhitespace:
* @ctx: the user data (XML parser context)
* @ch: a xmlChar string
* @len: the number of xmlChar
*
* receiving some ignorable whitespaces from the parser.
* UNUSED: by default the DOM building will use xmlSAX2Characters
*/
void
xmlSAX2IgnorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
{
/* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */
#ifdef DEBUG_SAX
#endif
}
/**
* xmlSAX2ProcessingInstruction:
* @ctx: the user data (XML parser context)
* @target: the target name
* @data: the PI data's
*
* A processing instruction has been parsed.
*/
void
{
#ifdef DEBUG_SAX
#endif
if (ctxt->linenumbers) {
else
}
}
return;
return;
}
#ifdef DEBUG_SAX_TREE
"Setting PI %s as root\n", target);
#endif
return;
}
#ifdef DEBUG_SAX_TREE
#endif
} else {
#ifdef DEBUG_SAX_TREE
"adding PI %s sibling to ", target);
#endif
}
}
/**
* xmlSAX2Comment:
* @ctx: the user data (XML parser context)
* @value: the xmlSAX2Comment content
*
* A xmlSAX2Comment has been parsed.
*/
void
{
#ifdef DEBUG_SAX
#endif
if (ctxt->linenumbers) {
else
}
}
return;
return;
}
#ifdef DEBUG_SAX_TREE
"Setting xmlSAX2Comment as root\n");
#endif
return;
}
#ifdef DEBUG_SAX_TREE
#endif
} else {
#ifdef DEBUG_SAX_TREE
"adding xmlSAX2Comment sibling to ");
#endif
}
}
/**
* xmlSAX2CDataBlock:
* @ctx: the user data (XML parser context)
* @value: The pcdata content
* @len: the block length
*
* called when a pcdata block has been parsed
*/
void
{
#ifdef DEBUG_SAX
#endif
#ifdef DEBUG_SAX_TREE
#endif
} else {
}
}
static int xmlSAX2DefaultVersionValue = 2;
#ifdef LIBXML_SAX1_ENABLED
/**
* xmlSAXDefaultVersion:
* @version: the version, 1 or 2
*
* Set the default version of SAX used globally by the library.
* By default, during initialization the default is set to 2.
* Note that it is generally a better coding style to use
* xmlSAXVersion() to set up the version explicitly for a given
* parsing context.
*
* Returns the previous value in case of success and -1 in case of error.
*/
int
{
int ret = xmlSAX2DefaultVersionValue;
return(-1);
return(ret);
}
#endif /* LIBXML_SAX1_ENABLED */
/**
* xmlSAXVersion:
* @hdlr: the SAX handler
* @version: the version, 1 or 2
*
* Initialize the default XML SAX handler according to the version
*
* Returns 0 in case of success and -1 in case of error.
*/
int
{
if (version == 2) {
#ifdef LIBXML_SAX1_ENABLED
} else if (version == 1) {
#endif /* LIBXML_SAX1_ENABLED */
} else
return(-1);
return(0);
}
/**
* xmlSAX2InitDefaultSAXHandler:
* @hdlr: the SAX handler
* @warning: flag if non-zero sets the handler warning procedure
*
* Initialize the default XML SAX2 handler
*/
void
{
return;
if (warning == 0)
else
}
/**
* xmlDefaultSAXHandlerInit:
*
* Initialize the default SAX2 handler
*/
void
xmlDefaultSAXHandlerInit(void)
{
#ifdef LIBXML_SAX1_ENABLED
#endif /* LIBXML_SAX1_ENABLED */
}
#ifdef LIBXML_HTML_ENABLED
/**
* xmlSAX2InitHtmlDefaultSAXHandler:
* @hdlr: the SAX handler
*
* Initialize the default HTML SAX2 handler
*/
void
{
return;
}
/**
* htmlDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/
void
{
}
#endif /* LIBXML_HTML_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
/**
* xmlSAX2InitDocbDefaultSAXHandler:
* @hdlr: the SAX handler
*
* Initialize the default DocBook SAX2 handler
*/
void
{
return;
}
/**
* docbDefaultSAXHandlerInit:
*
* Initialize the default SAX handler
*/
void
{
}
#endif /* LIBXML_DOCB_ENABLED */
#define bottom_SAX2
#include "elfgcchack.h"