f0ab104f070bc7f569404826fea1828ed985638cvboxsync * tree.c : implementation of access function for an XML tree.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * References:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * XHTML 1.0 W3C REC: http://www.w3.org/TR/2002/REC-xhtml1-20020801/
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * See Copyright for the status of this software.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * daniel@veillard.com
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/************************************************************************
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Forward declarations *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync ************************************************************************/
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncxmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncstatic xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop);
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/************************************************************************
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Tree memory error handler *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync ************************************************************************/
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * xmlTreeErrMemory:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @extra: extra informations
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Handle an out of memory condition
f0ab104f070bc7f569404826fea1828ed985638cvboxsync __xmlSimpleError(XML_FROM_TREE, XML_ERR_NO_MEMORY, NULL, NULL, extra);
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * xmlTreeErr:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @code: the error number
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @extra: extra informations
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Handle an out of memory condition
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncxmlTreeErr(int code, xmlNodePtr node, const char *extra)
f0ab104f070bc7f569404826fea1828ed985638cvboxsync __xmlSimpleError(XML_FROM_TREE, code, node, msg, extra);
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/************************************************************************
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * A few static variables and macros *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync ************************************************************************/
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/* #undef xmlStringText */
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncconst xmlChar xmlStringText[] = { 't', 'e', 'x', 't', 0 };
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/* #undef xmlStringTextNoenc */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync { 't', 'e', 'x', 't', 'n', 'o', 'e', 'n', 'c', 0 };
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/* #undef xmlStringComment */
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncconst xmlChar xmlStringComment[] = { 'c', 'o', 'm', 'm', 'e', 'n', 't', 0 };
f0ab104f070bc7f569404826fea1828ed985638cvboxsync#define UPDATE_LAST_CHILD_AND_PARENT(n) if ((n) != NULL) { \
f0ab104f070bc7f569404826fea1828ed985638cvboxsync#define IS_STR_XML(str) ((str != NULL) && (str[0] == 'x') && \
f0ab104f070bc7f569404826fea1828ed985638cvboxsync (str[1] == 'm') && (str[2] == 'l') && (str[3] == 0))
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/* #define DEBUG_BUFFER */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/* #define DEBUG_TREE */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/************************************************************************
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Functions to move to entities.c once the *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * API freeze is smoothen and they can be made public. *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync ************************************************************************/
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * xmlGetEntityFromDtd:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @dtd: A pointer to the DTD to search
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @name: The entity name
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Do an entity lookup in the DTD entity hash table and
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * return the corresponding entity, if found.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Returns A pointer to the entity structure or NULL if not found.
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncxmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
f0ab104f070bc7f569404826fea1828ed985638cvboxsync /* return(xmlGetEntityFromTable(table, name)); */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * xmlGetParameterEntityFromDtd:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @dtd: A pointer to the DTD to search
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @name: The entity name
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Do an entity lookup in the DTD pararmeter entity hash table and
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * return the corresponding entity, if found.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Returns A pointer to the entity structure or NULL if not found.
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncxmlGetParameterEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
f0ab104f070bc7f569404826fea1828ed985638cvboxsync /* return(xmlGetEntityFromTable(table, name)); */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync#endif /* LIBXML_TREE_ENABLED */
f0ab104f070bc7f569404826fea1828ed985638cvboxsync/************************************************************************
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * QName handling helper *
f0ab104f070bc7f569404826fea1828ed985638cvboxsync ************************************************************************/
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * xmlBuildQName:
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @ncname: the Name
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @prefix: the prefix
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @memory: preallocated memory
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @len: preallocated memory length
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Builds the QName @prefix:@ncname in @memory if there is enough space
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * and prefix is not NULL nor empty, otherwise allocate a new string.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * If prefix is NULL or empty it returns ncname.
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * Returns the new string which must be freed by the caller if different from
f0ab104f070bc7f569404826fea1828ed985638cvboxsync * @memory and @ncname or NULL in case of error
f0ab104f070bc7f569404826fea1828ed985638cvboxsyncxmlBuildQName(const xmlChar *ncname, const xmlChar *prefix,
return(NULL);
return(ret);
xmlChar *
#ifndef XML_XML_NAMESPACE
return(NULL);
return(NULL);
len++;
return(NULL);
return(NULL);
return(NULL);
return(ret);
const xmlChar *
return(NULL);
if (name[l] == 0)
return(NULL);
*len = l;
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
if (space)
cur++;
goto try_complex;
cur++;
if (space)
if (*cur == 0)
if (space) {
while (IS_BLANK(c)) {
cur += l;
cur += l;
IS_EXTENDER(c)) {
cur += l;
if (space) {
while (IS_BLANK(c)) {
cur += l;
if (space)
cur++;
goto try_complex;
cur++;
cur++;
cur++;
goto try_complex;
cur++;
if (space)
if (*cur == 0)
if (space) {
while (IS_BLANK(c)) {
cur += l;
cur += l;
IS_EXTENDER(c)) {
cur += l;
cur += l;
cur += l;
IS_EXTENDER(c)) {
cur += l;
if (space) {
while (IS_BLANK(c)) {
cur += l;
if (space)
cur++;
goto try_complex;
cur++;
if (space)
if (*cur == 0)
if (space) {
while (IS_BLANK(c)) {
cur += l;
cur += l;
cur += l;
if (space) {
while (IS_BLANK(c)) {
cur += l;
if (space)
cur++;
goto try_complex;
cur++;
if (space)
if (*cur == 0)
if (space) {
while (IS_BLANK(c)) {
cur += l;
cur += l;
cur += l;
if (space) {
while (IS_BLANK(c)) {
cur += l;
return(xmlBufferAllocScheme);
return(NULL);
return(NULL);
return(NULL);
return(NULL);
return(NULL);
return(cur);
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(NULL);
return(NULL);
return(NULL);
return(cur);
if (str) { \
if (dict) { \
if (str) { \
if (dict) { \
while (c != NULL) {
xmlUnlinkNode(c);
xmlFreeNode(c);
c = next;
return(NULL);
return(NULL);
return(cur);
#ifdef DEBUG_TREE
#ifdef LIBXML_DEBUG_RUNTIME
#ifdef LIBXML_DEBUG_ENABLED
const xmlChar *q;
q = cur;
if (cur != q) {
q = cur;
tmp = 0;
NULL);
charval = 0;
cur++;
tmp = 0;
cur++;
q = cur;
tmp = 0;
NULL);
charval = 0;
cur++;
tmp = 0;
cur++;
q = cur;
cur++;
q = cur;
return(ret);
if (cur != q) {
return(ret);
while (temp) {
cur++;
q = cur;
if (charval != 0) {
buf[l] = 0;
charval = 0;
cur++;
return(ret);
const xmlChar *q;
q = cur;
while (*cur != 0) {
if (cur != q) {
q = cur;
NULL);
charval = 0;
cur++;
cur++;
q = cur;
NULL);
charval = 0;
cur++;
cur++;
q = cur;
cur++;
q = cur;
if (*cur == 0) {
return(ret);
if (cur != q) {
return(ret);
while (temp) {
cur++;
q = cur;
if (charval != 0) {
charval = 0;
cur++;
return(ret);
xmlChar *
return (NULL);
if (inLine) {
if (inLine) {
* http://www.w3.org/TR/REC-xml#NT-content.
return (ret);
#ifdef LIBXML_TREE_ENABLED
xmlChar *
return (NULL);
if (inLine) {
if (inLine) {
* http://www.w3.org/TR/REC-xml#NT-content.
buffer =
return (ret);
static xmlAttrPtr
int eatname)
return (NULL);
return (NULL);
if (eatname == 0) {
return (cur);
defined(LIBXML_SCHEMAS_ENABLED)
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
return(cur);
return(cur);
#ifdef LIBXML_TREE_ENABLED
return(cur);
return(NULL);
return(cur);
return(NULL);
return(cur);
#ifdef LIBXML_TREE_ENABLED
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
return(NULL);
return(NULL);
name++;
return(cur);
return(NULL);
return(NULL);
name++;
return(cur);
return(cur);
return(NULL);
return(cur);
return(cur);
return(NULL);
return(cur);
return(NULL);
return(cur);
return(cur);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(cur);
static xmlNodePtr
return(NULL);
return prop;
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(cur);
return(elem);
defined(LIBXML_SCHEMAS_ENABLED)
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(cur);
return(elem);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(cur);
return(elem);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(cur);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(parent);
return(cur);
return(parent);
return(NULL);
if ((lastattr != NULL) && (lastattr != (xmlAttrPtr) cur) && (lastattr->type != XML_ATTRIBUTE_DECL)) {
return(cur);
return(cur);
#ifdef DEBUG_TREE
return(NULL);
#ifdef LIBXML_DOCB_ENABLED
#ifdef DEBUG_TREE
#ifdef DEBUG_TREE
return(NULL);
return(old);
return(old);
#ifdef DEBUG_TREE
return(old);
#ifdef DEBUG_TREE
return(old);
return(old);
case XML_LOCAL_NAMESPACE:
#ifdef DEBUG_TREE
return(NULL);
return(ret);
if (p == NULL) {
ret = p = q;
p->next = q;
return(ret);
static xmlNodePtr
static xmlAttrPtr
return(ret);
if (q == NULL)
return(NULL);
if (p == NULL) {
ret = p = q;
p->next = q;
q->prev = p;
return(ret);
static xmlNodePtr
int extended) {
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ELEMENT_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_ATTRIBUTE_NODE:
case XML_NAMESPACE_DECL:
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
#ifdef LIBXML_TREE_ENABLED
case XML_DOCUMENT_TYPE_NODE:
case XML_NOTATION_NODE:
case XML_DTD_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
return(NULL);
return(NULL);
return(tmp);
if (!extended)
goto out;
out:
return(ret);
static xmlNodePtr
#ifdef LIBXML_TREE_ENABLED
ret = p = q;
p->next = q;
q->prev = p;
return(ret);
return(ret);
return(ret);
return(ret);
return(ret);
#if defined(LIBXML_TREE_ENABLED)
q = NULL;
q = (xmlNodePtr)
q = (xmlNodePtr)
q = (xmlNodePtr)
if (q == NULL) {
if (p == NULL)
p->next = q;
q->prev = p;
return(ret);
#ifdef LIBXML_TREE_ENABLED
return(ret);
if (!node)
return result;
return result;
xmlChar *
return (NULL);
return (NULL);
return (NULL);
buffer[0] = 0;
occur = 0;
generic = 0;
(generic ||
occur++;
if (occur == 0) {
(generic ||
occur++;
if (occur != 0)
occur++;
occur++;
if (occur == 0) {
occur++;
if (occur != 0)
occur++;
occur++;
if (occur == 0) {
occur++;
occur++;
if (occur == 0) {
occur++;
if (occur != 0)
occur++;
buf_len =
return (NULL);
return (NULL);
if (occur == 0)
return (buffer);
return(ret);
return(ret);
return(NULL);
return(old);
#if defined(LIBXML_TREE_ENABLED)
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_NOTATION_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DTD_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
case XML_PI_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_NAMESPACE_DECL:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
xmlChar *
return(lang);
return(NULL);
#ifdef LIBXML_TREE_ENABLED
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_NOTATION_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DTD_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
case XML_PI_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
switch (val) {
#ifdef LIBXML_TREE_ENABLED
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_NOTATION_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_PI_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_DTD_NODE:
case XML_DOCUMENT_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_NOTATION_NODE:
case XML_DTD_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
case XML_PI_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_DOCUMENT_NODE:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE: {
xmlChar *
return(NULL);
return(NULL);
return(NULL);
return(oldbase);
return(newbase);
return(oldbase);
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE:{
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
case XML_ENTITY_REF_NODE:
case XML_ATTRIBUTE_NODE:{
case XML_COMMENT_NODE:
case XML_PI_NODE:
case XML_ENTITY_REF_NODE:{
* http://www.w3.org/TR/REC-xml#NT-content
while (tmp) {
case XML_ENTITY_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_NOTATION_NODE:
case XML_DTD_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_DOCUMENT_NODE:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_NAMESPACE_DECL:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
xmlChar *
return (NULL);
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE:{
return (NULL);
return (ret);
case XML_ATTRIBUTE_NODE:
case XML_COMMENT_NODE:
case XML_PI_NODE:
return (NULL);
case XML_ENTITY_REF_NODE:{
return (NULL);
return (NULL);
return (ret);
case XML_ENTITY_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_NOTATION_NODE:
case XML_DTD_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
return (NULL);
case XML_DOCUMENT_NODE:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE: {
return (NULL);
return (ret);
case XML_NAMESPACE_DECL: {
return (tmp);
case XML_ELEMENT_DECL:
return (NULL);
case XML_ATTRIBUTE_DECL:
return (NULL);
case XML_ENTITY_DECL:
return (NULL);
case XML_CDATA_SECTION_NODE:
case XML_TEXT_NODE:
return (NULL);
return (NULL);
#ifdef DEBUG_TREE
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_NOTATION_NODE:
case XML_DTD_NODE:
case XML_NAMESPACE_DECL:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
#ifdef LIBXML_TREE_ENABLED
#ifdef DEBUG_TREE
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_NOTATION_NODE:
case XML_DOCUMENT_NODE:
case XML_DTD_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
#ifdef DEBUG_TREE
if (len <= 0) return;
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE: {
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_NOTATION_NODE:
case XML_DOCUMENT_NODE:
case XML_DTD_NODE:
case XML_HTML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_NAMESPACE_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
#ifdef LIBXML_DOCB_ENABLED
case XML_DOCB_DOCUMENT_NODE:
case XML_ELEMENT_DECL:
case XML_ATTRIBUTE_DECL:
case XML_ENTITY_DECL:
#ifdef DEBUG_TREE
return(first);
return(first);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
xmlNsPtr *
ret =
sizeof(xmlNsPtr));
return (NULL);
for (i = 0; i < nbns; i++) {
if (i >= nbns) {
(maxns +
sizeof(xmlNsPtr));
return (NULL);
return (ret);
static xmlNsPtr
return (NULL);
return (NULL);
return (ns);
return(NULL);
return(cur);
return(NULL);
return(NULL);
return(cur);
return(cur);
return(cur);
return(cur);
return(NULL);
return (NULL);
return (NULL);
return (cur);
return(NULL);
return (NULL);
return (cur);
return (cur);
return (NULL);
#ifdef DEBUG_TREE
return(NULL);
#ifdef DEBUG_TREE
return(NULL);
return(def);
return(def);
#ifdef LIBXML_TREE_ENABLED
xmlNsPtr n;
if (sizeCache == 0) {
sizeof(xmlNsPtr));
sizeof(xmlNsPtr));
for (i = 0;i < nbCache;i++) {
if (i == nbCache) {
sizeof(xmlNsPtr));
sizeof(xmlNsPtr));
if (sizeCache == 0) {
sizeof(xmlNsPtr));
sizeof(xmlNsPtr));
for (i = 0;i < nbCache;i++) {
if (i == nbCache) {
return(ret);
static xmlAttrPtr
return(NULL);
return(prop);
return(prop);
#ifdef LIBXML_TREE_ENABLED
if (! useDTD)
return(NULL);
return(NULL);
return(NULL);
if (attrDecl)
if (attrDecl)
cur++;
return(NULL);
static xmlChar*
return(NULL);
return(ret);
return(NULL);
return(NULL);
return(prop);
return(NULL);
xmlChar *
return(NULL);
xmlChar *
return(NULL);
xmlChar *
return(NULL);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
return(NULL);
return(NULL);
return(prop);
while (*cur != 0) {
cur++;
#ifdef DEBUG_TREE
return(NULL);
return(NULL);
return(ret);
return(NULL);
return(NULL);
return(ret);
return(NULL);
return(NULL);
return(ret);
#ifdef DEBUG_BUFFER
#ifdef DEBUG_BUFFER
if (len == 0) return(0);
return(len);
#ifdef WIN32
#ifdef DEBUG_BUFFER
#ifdef DEBUG_BUFFER
return(ret);
const xmlChar *
if(!buf)
return NULL;
if(!buf)
case XML_BUFFER_ALLOC_EXACT:
#ifdef DEBUG_BUFFER
if (len == 0) return 0;
if (len < 0)
if (len == 0) return 0;
return XML_ERR_NO_MEMORY;
#ifdef DEBUG_BUFFER
#ifdef DEBUG_BUFFER
if (len == 0) return 0;
if (len < 0)
return XML_ERR_NO_MEMORY;
#ifdef DEBUG_BUFFER
return XML_ERR_NO_MEMORY;
#ifdef DEBUG_BUFFER
while(*cur != 0){
cur++;
cur++;
return (xmlCompressMode);
i = (m)->last; \
(m)->pool = i;
static xmlNsMapItemPtr
return(NULL);
return(NULL);
return (NULL);
return (NULL);
} else if (position == 0) {
return(NULL);
return (ret);
static xmlNsPtr
return (NULL);
return (NULL);
return (ns);
return (NULL);
return (ret);
static xmlNsPtr
return (NULL);
return (ns);
return (NULL);
shadowed = 0;
if (shadowed)
*number = 0;
(*number)++;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_ELEMENT_NODE:
goto internal_error;
case XML_ATTRIBUTE_NODE:
goto next_node;
goto internal_error;
goto internal_error;
goto next_sibling;
goto next_sibling;
if (out) {
if (ret < 0)
if (! ret)
if (retNs)
if (retNs) {
if (retNs)
static xmlNsPtr
int checkShadow)
goto ns_next_prefix;
goto ns_next_prefix;
return (NULL);
return (ret);
counter++;
return (NULL);
int depth,
int ancestorsOnly,
int prefixed)
int options)
case XML_ELEMENT_NODE:
depth++;
if (! parnsdone) {
goto internal_error;
goto internal_error;
if (prevns)
goto next_ns_decl;
adoptns = 0;
goto internal_error;
if (! adoptns)
goto ns_end;
case XML_ATTRIBUTE_NODE:
goto ns_end;
if (! parnsdone) {
goto internal_error;
if (listRedund) {
goto ns_end;
goto internal_error;
goto next_sibling;
depth--;
goto into_content;
goto next_sibling;
ret = 0;
goto exit;
exit:
if (listRedund) {
return (ret);
adoptStr = 0;
if (ctxt)
parnsdone = 0;
goto leave_node;
goto leave_node;
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_ELEMENT_NODE:
depth++;
if (! parnsdone) {
goto internal_error;
goto internal_error;
case XML_ATTRIBUTE_NODE:
goto ns_end;
if (! parnsdone) {
goto internal_error;
goto ns_end;
goto internal_error;
goto internal_error;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
goto leave_node;
case XML_ENTITY_REF_NODE:
goto leave_node;
case XML_PI_NODE:
case XML_COMMENT_NODE:
goto internal_error;
depth--;
goto leave_node;
goto exit;
exit:
return(ret);
int deep,
if (ctxt)
goto internal_error;
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
goto internal_error;
case XML_ELEMENT_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_PI_NODE:
case XML_DOCUMENT_FRAG_NODE:
case XML_ENTITY_REF_NODE:
case XML_ENTITY_NODE:
goto internal_error;
if (prevClone) {
case XML_ATTRIBUTE_NODE:
goto internal_error;
if (prevClone) {
goto internal_error;
* in tree.c, it might be set in Libxslt via
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
case XML_ELEMENT_NODE:
depth++;
if (! parnsdone) {
goto internal_error;
goto internal_error;
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
goto leave_node;
case XML_ENTITY_NODE:
goto leave_node;
case XML_ENTITY_REF_NODE:
goto leave_node;
case XML_PI_NODE:
goto leave_node;
case XML_COMMENT_NODE:
goto leave_node;
goto internal_error;
goto end_ns_reference;
if (! parnsdone) {
goto internal_error;
goto end_ns_reference;
goto internal_error;
goto internal_error;
goto internal_error;
depth--;
goto leave_node;
goto into_content;
goto exit;
exit:
return (ret);
goto internal_error;
goto internal_error;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
goto next_sibling;
int options)
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
case XML_DOCUMENT_FRAG_NODE:
adoptStr = 0;
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_ENTITY_REF_NODE:
case XML_PI_NODE: {
#include "elfgcchack.h"