mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
added a parser XML_PARSE_COMPACT option to allocate small text nodes (less
* HTMLparser.c parser.c SAX2.c debugXML.c tree.c valid.c xmlreader.c xmllint.c include/libxml/HTMLparser.h include/libxml/parser.h: added a parser XML_PARSE_COMPACT option to allocate small text nodes (less than 8 bytes on 32bits, less than 16bytes on 64bits) directly within the node, various changes to cope with this. * result/XPath/tests/* result/XPath/xptr/* result/xmlid/*: this slightly change the output Daniel
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Thu Aug 25 15:14:56 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* HTMLparser.c parser.c SAX2.c debugXML.c tree.c valid.c xmlreader.c
|
||||||
|
xmllint.c include/libxml/HTMLparser.h include/libxml/parser.h:
|
||||||
|
added a parser XML_PARSE_COMPACT option to allocate small
|
||||||
|
text nodes (less than 8 bytes on 32bits, less than 16bytes on 64bits)
|
||||||
|
directly within the node, various changes to cope with this.
|
||||||
|
* result/XPath/tests/* result/XPath/xptr/* result/xmlid/*: this
|
||||||
|
slightly change the output
|
||||||
|
|
||||||
Thu Aug 25 12:16:26 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
Thu Aug 25 12:16:26 CEST 2005 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* configure.in: patch from Andrew W. Nosenko, use se $GCC = 'yes'
|
* configure.in: patch from Andrew W. Nosenko, use se $GCC = 'yes'
|
||||||
|
@ -5820,6 +5820,10 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
|
|||||||
ctxt->recovery = 1;
|
ctxt->recovery = 1;
|
||||||
} else
|
} else
|
||||||
ctxt->recovery = 0;
|
ctxt->recovery = 0;
|
||||||
|
if (options & HTML_PARSE_COMPACT) {
|
||||||
|
ctxt->options |= HTML_PARSE_COMPACT;
|
||||||
|
options -= HTML_PARSE_COMPACT;
|
||||||
|
}
|
||||||
ctxt->dictNames = 0;
|
ctxt->dictNames = 0;
|
||||||
return (options);
|
return (options);
|
||||||
}
|
}
|
||||||
|
18
SAX2.c
18
SAX2.c
@ -1777,6 +1777,7 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
|
|||||||
xmlErrMemory(ctxt, "xmlSAX2Characters");
|
xmlErrMemory(ctxt, "xmlSAX2Characters");
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
memset(ret, 0, sizeof(xmlNode));
|
||||||
/*
|
/*
|
||||||
* intern the formatting blanks found between tags, or the
|
* intern the formatting blanks found between tags, or the
|
||||||
* very short strings
|
* very short strings
|
||||||
@ -1784,7 +1785,14 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
|
|||||||
if (ctxt->dictNames) {
|
if (ctxt->dictNames) {
|
||||||
xmlChar cur = str[len];
|
xmlChar cur = str[len];
|
||||||
|
|
||||||
if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
|
if ((len < (int) (2 * sizeof(void *))) &&
|
||||||
|
(ctxt->options & XML_PARSE_COMPACT)) {
|
||||||
|
/* store the string in the node overrithing properties and nsDef */
|
||||||
|
xmlChar *tmp = (xmlChar *) &(ret->properties);
|
||||||
|
memcpy(tmp, str, len);
|
||||||
|
tmp[len] = 0;
|
||||||
|
intern = tmp;
|
||||||
|
} else if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
|
||||||
((cur == '<') && (str[len + 1] != '!')))) {
|
((cur == '<') && (str[len + 1] != '!')))) {
|
||||||
intern = xmlDictLookup(ctxt->dict, str, len);
|
intern = xmlDictLookup(ctxt->dict, str, len);
|
||||||
} else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') &&
|
} else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') &&
|
||||||
@ -1798,7 +1806,6 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
skip:
|
skip:
|
||||||
memset(ret, 0, sizeof(xmlNode));
|
|
||||||
ret->type = XML_TEXT_NODE;
|
ret->type = XML_TEXT_NODE;
|
||||||
|
|
||||||
ret->name = xmlStringText;
|
ret->name = xmlStringText;
|
||||||
@ -2407,8 +2414,11 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
|||||||
* We try to minimaze realloc() uses and avoid copying
|
* We try to minimaze realloc() uses and avoid copying
|
||||||
* and recomputing length over and over.
|
* and recomputing length over and over.
|
||||||
*/
|
*/
|
||||||
if ((ctxt->nodemem == ctxt->nodelen + 1) &&
|
if (lastChild->content == (xmlChar *)&(lastChild->properties)) {
|
||||||
(xmlDictOwns(ctxt->dict, lastChild->content))) {
|
lastChild->content = xmlStrdup(lastChild->content);
|
||||||
|
lastChild->properties = NULL;
|
||||||
|
} else if ((ctxt->nodemem == ctxt->nodelen + 1) &&
|
||||||
|
(xmlDictOwns(ctxt->dict, lastChild->content))) {
|
||||||
lastChild->content = xmlStrdup(lastChild->content);
|
lastChild->content = xmlStrdup(lastChild->content);
|
||||||
}
|
}
|
||||||
if (ctxt->nodelen + len >= ctxt->nodemem) {
|
if (ctxt->nodelen + len >= ctxt->nodemem) {
|
||||||
|
14
debugXML.c
14
debugXML.c
@ -902,9 +902,15 @@ xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
|
|||||||
if (!ctxt->check) {
|
if (!ctxt->check) {
|
||||||
xmlCtxtDumpSpaces(ctxt);
|
xmlCtxtDumpSpaces(ctxt);
|
||||||
if (node->name == (const xmlChar *) xmlStringTextNoenc)
|
if (node->name == (const xmlChar *) xmlStringTextNoenc)
|
||||||
fprintf(ctxt->output, "TEXT no enc\n");
|
fprintf(ctxt->output, "TEXT no enc");
|
||||||
else
|
else
|
||||||
fprintf(ctxt->output, "TEXT\n");
|
fprintf(ctxt->output, "TEXT");
|
||||||
|
if (node->content == (xmlChar *) &(node->properties))
|
||||||
|
fprintf(ctxt->output, " compact\n");
|
||||||
|
else if (xmlDictOwns(ctxt->dict, node->content) == 1)
|
||||||
|
fprintf(ctxt->output, " interned\n");
|
||||||
|
else
|
||||||
|
fprintf(ctxt->output, "\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XML_CDATA_SECTION_NODE:
|
case XML_CDATA_SECTION_NODE:
|
||||||
@ -1005,9 +1011,9 @@ xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
|
|||||||
fprintf(ctxt->output, "PBM: doc == NULL !!!\n");
|
fprintf(ctxt->output, "PBM: doc == NULL !!!\n");
|
||||||
}
|
}
|
||||||
ctxt->depth++;
|
ctxt->depth++;
|
||||||
if (node->nsDef != NULL)
|
if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
|
||||||
xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
|
xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
|
||||||
if (node->properties != NULL)
|
if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
|
||||||
xmlCtxtDumpAttrList(ctxt, node->properties);
|
xmlCtxtDumpAttrList(ctxt, node->properties);
|
||||||
if (node->type != XML_ENTITY_REF_NODE) {
|
if (node->type != XML_ENTITY_REF_NODE) {
|
||||||
if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
|
if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
|
||||||
|
@ -178,7 +178,8 @@ typedef enum {
|
|||||||
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
|
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
|
||||||
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
|
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
|
||||||
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
|
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
|
||||||
HTML_PARSE_NONET = 1<<11 /* Forbid network access */
|
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
|
||||||
|
HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */
|
||||||
} htmlParserOption;
|
} htmlParserOption;
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
XMLPUBFUN void XMLCALL
|
||||||
|
@ -1088,7 +1088,8 @@ typedef enum {
|
|||||||
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */
|
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */
|
||||||
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
|
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
|
||||||
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
|
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
|
||||||
XML_PARSE_NOXINCNODE= 1<<15 /* do not generate XINCLUDE START/END nodes */
|
XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
|
||||||
|
XML_PARSE_COMPACT = 1<<16 /* compact small text nodes */
|
||||||
} xmlParserOption;
|
} xmlParserOption;
|
||||||
|
|
||||||
XMLPUBFUN void XMLCALL
|
XMLPUBFUN void XMLCALL
|
||||||
|
11
parser.c
11
parser.c
@ -684,7 +684,7 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* plit the element name into prefix:localname , the string found
|
* Split the element name into prefix:localname , the string found
|
||||||
* are within the DTD and hen not associated to namespace names.
|
* are within the DTD and hen not associated to namespace names.
|
||||||
*/
|
*/
|
||||||
name = xmlSplitQName3(fullattr, &len);
|
name = xmlSplitQName3(fullattr, &len);
|
||||||
@ -11319,8 +11319,9 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
|
|||||||
*lst = cur;
|
*lst = cur;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
#ifdef LIBXML_VALID_ENABLED
|
#ifdef LIBXML_VALID_ENABLED
|
||||||
if (oldctxt->validate && oldctxt->wellFormed &&
|
if ((oldctxt->validate) && (oldctxt->wellFormed) &&
|
||||||
oldctxt->myDoc && oldctxt->myDoc->intSubset) {
|
(oldctxt->myDoc) && (oldctxt->myDoc->intSubset) &&
|
||||||
|
(cur->type == XML_ELEMENT_NODE)) {
|
||||||
oldctxt->valid &= xmlValidateElement(&oldctxt->vctxt,
|
oldctxt->valid &= xmlValidateElement(&oldctxt->vctxt,
|
||||||
oldctxt->myDoc, cur);
|
oldctxt->myDoc, cur);
|
||||||
}
|
}
|
||||||
@ -12843,6 +12844,10 @@ xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options)
|
|||||||
ctxt->options |= XML_PARSE_NONET;
|
ctxt->options |= XML_PARSE_NONET;
|
||||||
options -= XML_PARSE_NONET;
|
options -= XML_PARSE_NONET;
|
||||||
}
|
}
|
||||||
|
if (options & XML_PARSE_COMPACT) {
|
||||||
|
ctxt->options |= XML_PARSE_COMPACT;
|
||||||
|
options -= XML_PARSE_COMPACT;
|
||||||
|
}
|
||||||
ctxt->linenumbers = 1;
|
ctxt->linenumbers = 1;
|
||||||
return (options);
|
return (options);
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,10 @@ Set contains 1 nodes:
|
|||||||
Expression: /child::EXAMPLE/child::head/node()
|
Expression: /child::EXAMPLE/child::head/node()
|
||||||
Object is a Node Set :
|
Object is a Node Set :
|
||||||
Set contains 3 nodes:
|
Set contains 3 nodes:
|
||||||
1 TEXT
|
1 TEXT compact
|
||||||
content=
|
content=
|
||||||
2 ELEMENT title
|
2 ELEMENT title
|
||||||
3 TEXT
|
3 TEXT compact
|
||||||
content=
|
content=
|
||||||
|
|
||||||
========================
|
========================
|
||||||
|
@ -5,7 +5,7 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT EXAMPLE
|
1 ELEMENT EXAMPLE
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
ATTRIBUTE prop1
|
ATTRIBUTE prop1
|
||||||
TEXT
|
TEXT
|
||||||
|
@ -5,30 +5,30 @@ Object is a Node Set :
|
|||||||
Set contains 9 nodes:
|
Set contains 9 nodes:
|
||||||
1 ELEMENT b
|
1 ELEMENT b
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=en
|
content=en
|
||||||
2 ELEMENT x
|
2 ELEMENT x
|
||||||
3 ELEMENT x
|
3 ELEMENT x
|
||||||
4 ELEMENT para
|
4 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=en
|
content=en
|
||||||
5 ELEMENT div
|
5 ELEMENT div
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=en
|
content=en
|
||||||
6 ELEMENT para
|
6 ELEMENT para
|
||||||
7 ELEMENT para
|
7 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=EN
|
content=EN
|
||||||
8 ELEMENT para
|
8 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=en-us
|
content=en-us
|
||||||
9 ELEMENT para
|
9 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=EN-US
|
content=EN-US
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -37,11 +37,11 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 ELEMENT para
|
1 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=en-us
|
content=en-us
|
||||||
2 ELEMENT para
|
2 ELEMENT para
|
||||||
ATTRIBUTE lang
|
ATTRIBUTE lang
|
||||||
TEXT
|
TEXT compact
|
||||||
content=EN-US
|
content=EN-US
|
||||||
|
|
||||||
========================
|
========================
|
||||||
|
@ -5,7 +5,7 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -14,11 +14,11 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT s
|
2 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -27,11 +27,11 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT s
|
2 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -40,11 +40,11 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT s
|
2 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -53,15 +53,15 @@ Object is a Node Set :
|
|||||||
Set contains 3 nodes:
|
Set contains 3 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT s
|
2 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
3 ELEMENT s
|
3 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p2
|
content=p2
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -70,16 +70,16 @@ Object is a Node Set :
|
|||||||
Set contains 4 nodes:
|
Set contains 4 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT p1
|
2 ELEMENT p1
|
||||||
3 ELEMENT s
|
3 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
4 ELEMENT s
|
4 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p2
|
content=p2
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -88,14 +88,14 @@ Object is a Node Set :
|
|||||||
Set contains 4 nodes:
|
Set contains 4 nodes:
|
||||||
1 ELEMENT s
|
1 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=root
|
content=root
|
||||||
2 ELEMENT p1
|
2 ELEMENT p1
|
||||||
3 ELEMENT s
|
3 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p1
|
content=p1
|
||||||
4 ELEMENT s
|
4 ELEMENT s
|
||||||
ATTRIBUTE p
|
ATTRIBUTE p
|
||||||
TEXT
|
TEXT compact
|
||||||
content=p2
|
content=p2
|
||||||
|
@ -45,7 +45,7 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 TEXT
|
1 TEXT
|
||||||
content=bla bla bla ...
|
content=bla bla bla ...
|
||||||
2 TEXT
|
2 TEXT compact
|
||||||
content=...
|
content=...
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -54,7 +54,7 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 TEXT
|
1 TEXT
|
||||||
content=bla bla bla ...
|
content=bla bla bla ...
|
||||||
2 TEXT
|
2 TEXT compact
|
||||||
content=...
|
content=...
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -63,7 +63,7 @@ Object is a Node Set :
|
|||||||
Set contains 2 nodes:
|
Set contains 2 nodes:
|
||||||
1 TEXT
|
1 TEXT
|
||||||
content=bla bla bla ...
|
content=bla bla bla ...
|
||||||
2 TEXT
|
2 TEXT compact
|
||||||
content=...
|
content=...
|
||||||
|
|
||||||
========================
|
========================
|
||||||
@ -77,5 +77,5 @@ Set contains 1 nodes:
|
|||||||
Expression: (//p/text())[position()=last()]
|
Expression: (//p/text())[position()=last()]
|
||||||
Object is a Node Set :
|
Object is a Node Set :
|
||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 TEXT
|
1 TEXT compact
|
||||||
content=...
|
content=...
|
||||||
|
@ -53,10 +53,10 @@ Set contains 1 nodes:
|
|||||||
Expression: /child::EXAMPLE/child::head/node()
|
Expression: /child::EXAMPLE/child::head/node()
|
||||||
Object is a Node Set :
|
Object is a Node Set :
|
||||||
Set contains 3 nodes:
|
Set contains 3 nodes:
|
||||||
1 TEXT
|
1 TEXT compact
|
||||||
content=
|
content=
|
||||||
2 ELEMENT title
|
2 ELEMENT title
|
||||||
3 TEXT
|
3 TEXT compact
|
||||||
content=
|
content=
|
||||||
|
|
||||||
========================
|
========================
|
||||||
|
@ -5,8 +5,8 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT ITEM
|
1 ELEMENT ITEM
|
||||||
ATTRIBUTE monto
|
ATTRIBUTE monto
|
||||||
TEXT
|
TEXT compact
|
||||||
content=50.12
|
content=50.12
|
||||||
ATTRIBUTE divisa
|
ATTRIBUTE divisa
|
||||||
TEXT
|
TEXT compact
|
||||||
content=DOL
|
content=DOL
|
||||||
|
@ -44,7 +44,7 @@ Expression: xpointer(string-range(//p, 'difficult'))
|
|||||||
Object is a Location Set:
|
Object is a Location Set:
|
||||||
1 : Object is a range :
|
1 : Object is a range :
|
||||||
From index 3 in node
|
From index 3 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=a diff
|
content=a diff
|
||||||
To index 4 in node
|
To index 4 in node
|
||||||
TEXT
|
TEXT
|
||||||
@ -56,10 +56,10 @@ Expression: xpointer(string-range(//p, 'spanning'))
|
|||||||
Object is a Location Set:
|
Object is a Location Set:
|
||||||
1 : Object is a range :
|
1 : Object is a range :
|
||||||
From index 3 in node
|
From index 3 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=a span
|
content=a span
|
||||||
To index 3 in node
|
To index 3 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=ing one
|
content=ing one
|
||||||
|
|
||||||
|
|
||||||
@ -80,17 +80,17 @@ Expression: xpointer(string-range(//seq, ''))
|
|||||||
Object is a Location Set:
|
Object is a Location Set:
|
||||||
1 : Object is a collapsed range :
|
1 : Object is a collapsed range :
|
||||||
index 1 in node
|
index 1 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=123
|
content=123
|
||||||
2 : Object is a collapsed range :
|
2 : Object is a collapsed range :
|
||||||
index 2 in node
|
index 2 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=123
|
content=123
|
||||||
3 : Object is a collapsed range :
|
3 : Object is a collapsed range :
|
||||||
index 3 in node
|
index 3 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=123
|
content=123
|
||||||
4 : Object is a collapsed range :
|
4 : Object is a collapsed range :
|
||||||
index 4 in node
|
index 4 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=123
|
content=123
|
||||||
|
@ -60,5 +60,5 @@ Expression: xpointer(string-range(//p, 'difficult', 1, 0))
|
|||||||
Object is a Location Set:
|
Object is a Location Set:
|
||||||
1 : Object is a collapsed range :
|
1 : Object is a collapsed range :
|
||||||
index 3 in node
|
index 3 in node
|
||||||
TEXT
|
TEXT compact
|
||||||
content=a diff
|
content=a diff
|
||||||
|
@ -2,5 +2,5 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT foo
|
1 ELEMENT foo
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=bar
|
content=bar
|
||||||
|
@ -2,5 +2,5 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT foo
|
1 ELEMENT foo
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=bar
|
content=bar
|
||||||
|
@ -2,5 +2,5 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT foo
|
1 ELEMENT foo
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=bar
|
content=bar
|
||||||
|
@ -2,5 +2,5 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT o:o
|
1 ELEMENT o:o
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=bar
|
content=bar
|
||||||
|
@ -2,5 +2,5 @@ Object is a Node Set :
|
|||||||
Set contains 1 nodes:
|
Set contains 1 nodes:
|
||||||
1 ELEMENT foo
|
1 ELEMENT foo
|
||||||
ATTRIBUTE id
|
ATTRIBUTE id
|
||||||
TEXT
|
TEXT compact
|
||||||
content=bar
|
content=bar
|
||||||
|
@ -4306,7 +4306,7 @@ launchTests(testDescPtr tst) {
|
|||||||
testErrorsSize = 0;
|
testErrorsSize = 0;
|
||||||
testErrors[0] = 0;
|
testErrors[0] = 0;
|
||||||
res = tst->func(globbuf.gl_pathv[i], result, error,
|
res = tst->func(globbuf.gl_pathv[i], result, error,
|
||||||
tst->options);
|
tst->options | XML_PARSE_COMPACT);
|
||||||
xmlResetLastError();
|
xmlResetLastError();
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
fprintf(stderr, "File %s generated an error\n",
|
fprintf(stderr, "File %s generated an error\n",
|
||||||
|
@ -178,9 +178,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
if (document == NULL) {
|
if (document == NULL) {
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
document = xmlReadDoc(buffer,NULL,NULL,0);
|
document = xmlReadDoc(buffer,NULL,NULL,XML_PARSE_COMPACT);
|
||||||
else
|
else
|
||||||
document = xmlReadFile(filename,NULL,0);
|
document = xmlReadFile(filename,NULL,XML_PARSE_COMPACT);
|
||||||
}
|
}
|
||||||
for (i = 1; i < argc ; i++) {
|
for (i = 1; i < argc ; i++) {
|
||||||
if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) {
|
if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "--input"))) {
|
||||||
|
58
tree.c
58
tree.c
@ -3287,7 +3287,8 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
|||||||
if ((cur->type != XML_ELEMENT_NODE) &&
|
if ((cur->type != XML_ELEMENT_NODE) &&
|
||||||
(cur->type != XML_XINCLUDE_START) &&
|
(cur->type != XML_XINCLUDE_START) &&
|
||||||
(cur->type != XML_XINCLUDE_END) &&
|
(cur->type != XML_XINCLUDE_END) &&
|
||||||
(cur->type != XML_ENTITY_REF_NODE)) {
|
(cur->type != XML_ENTITY_REF_NODE) &&
|
||||||
|
(cur->content != (xmlChar *) &(cur->properties))) {
|
||||||
DICT_FREE(cur->content)
|
DICT_FREE(cur->content)
|
||||||
}
|
}
|
||||||
if (((cur->type == XML_ELEMENT_NODE) ||
|
if (((cur->type == XML_ELEMENT_NODE) ||
|
||||||
@ -3356,7 +3357,8 @@ xmlFreeNode(xmlNodePtr cur) {
|
|||||||
(cur->content != NULL) &&
|
(cur->content != NULL) &&
|
||||||
(cur->type != XML_ENTITY_REF_NODE) &&
|
(cur->type != XML_ENTITY_REF_NODE) &&
|
||||||
(cur->type != XML_XINCLUDE_END) &&
|
(cur->type != XML_XINCLUDE_END) &&
|
||||||
(cur->type != XML_XINCLUDE_START)) {
|
(cur->type != XML_XINCLUDE_START) &&
|
||||||
|
(cur->content != (xmlChar *) &(cur->properties))) {
|
||||||
DICT_FREE(cur->content)
|
DICT_FREE(cur->content)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3811,7 +3813,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
|
|
||||||
if (!extended)
|
if (!extended)
|
||||||
goto out;
|
goto out;
|
||||||
if (node->nsDef != NULL)
|
if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
|
||||||
ret->nsDef = xmlCopyNamespaceList(node->nsDef);
|
ret->nsDef = xmlCopyNamespaceList(node->nsDef);
|
||||||
|
|
||||||
if (node->ns != NULL) {
|
if (node->ns != NULL) {
|
||||||
@ -3838,7 +3840,7 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
ret->ns = ns;
|
ret->ns = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node->properties != NULL)
|
if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
|
||||||
ret->properties = xmlCopyPropList(ret, node->properties);
|
ret->properties = xmlCopyPropList(ret, node->properties);
|
||||||
if (node->type == XML_ENTITY_REF_NODE) {
|
if (node->type == XML_ENTITY_REF_NODE) {
|
||||||
if ((doc == NULL) || (node->doc != doc)) {
|
if ((doc == NULL) || (node->doc != doc)) {
|
||||||
@ -5106,7 +5108,8 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
|
|||||||
case XML_ENTITY_NODE:
|
case XML_ENTITY_NODE:
|
||||||
case XML_PI_NODE:
|
case XML_PI_NODE:
|
||||||
case XML_COMMENT_NODE:
|
case XML_COMMENT_NODE:
|
||||||
if (cur->content != NULL) {
|
if ((cur->content != NULL) &&
|
||||||
|
(cur->content != (xmlChar *) &(cur->properties))) {
|
||||||
if (!((cur->doc != NULL) && (cur->doc->dict != NULL) &&
|
if (!((cur->doc != NULL) && (cur->doc->dict != NULL) &&
|
||||||
(xmlDictOwns(cur->doc->dict, cur->content))))
|
(xmlDictOwns(cur->doc->dict, cur->content))))
|
||||||
xmlFree(cur->content);
|
xmlFree(cur->content);
|
||||||
@ -5117,6 +5120,8 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) {
|
|||||||
cur->content = xmlStrdup(content);
|
cur->content = xmlStrdup(content);
|
||||||
} else
|
} else
|
||||||
cur->content = NULL;
|
cur->content = NULL;
|
||||||
|
cur->properties = NULL;
|
||||||
|
cur->nsDef = NULL;
|
||||||
break;
|
break;
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
case XML_HTML_DOCUMENT_NODE:
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
@ -5178,8 +5183,11 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
|||||||
case XML_PI_NODE:
|
case XML_PI_NODE:
|
||||||
case XML_COMMENT_NODE:
|
case XML_COMMENT_NODE:
|
||||||
case XML_NOTATION_NODE:
|
case XML_NOTATION_NODE:
|
||||||
if (cur->content != NULL) {
|
if ((cur->content != NULL) &&
|
||||||
xmlFree(cur->content);
|
(cur->content != (xmlChar *) &(cur->properties))) {
|
||||||
|
if (!((cur->doc != NULL) && (cur->doc->dict != NULL) &&
|
||||||
|
(xmlDictOwns(cur->doc->dict, cur->content))))
|
||||||
|
xmlFree(cur->content);
|
||||||
}
|
}
|
||||||
if (cur->children != NULL) xmlFreeNodeList(cur->children);
|
if (cur->children != NULL) xmlFreeNodeList(cur->children);
|
||||||
cur->children = cur->last = NULL;
|
cur->children = cur->last = NULL;
|
||||||
@ -5187,6 +5195,8 @@ xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
|||||||
cur->content = xmlStrndup(content, len);
|
cur->content = xmlStrndup(content, len);
|
||||||
} else
|
} else
|
||||||
cur->content = NULL;
|
cur->content = NULL;
|
||||||
|
cur->properties = NULL;
|
||||||
|
cur->nsDef = NULL;
|
||||||
break;
|
break;
|
||||||
case XML_DOCUMENT_NODE:
|
case XML_DOCUMENT_NODE:
|
||||||
case XML_DTD_NODE:
|
case XML_DTD_NODE:
|
||||||
@ -5257,10 +5267,12 @@ xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
|
|||||||
case XML_COMMENT_NODE:
|
case XML_COMMENT_NODE:
|
||||||
case XML_NOTATION_NODE:
|
case XML_NOTATION_NODE:
|
||||||
if (content != NULL) {
|
if (content != NULL) {
|
||||||
if ((cur->doc != NULL) && (cur->doc->dict != NULL) &&
|
if ((cur->content == (xmlChar *) &(cur->properties)) ||
|
||||||
xmlDictOwns(cur->doc->dict, cur->content)) {
|
((cur->doc != NULL) && (cur->doc->dict != NULL) &&
|
||||||
cur->content =
|
xmlDictOwns(cur->doc->dict, cur->content))) {
|
||||||
xmlStrncatNew(cur->content, content, len);
|
cur->content = xmlStrncatNew(cur->content, content, len);
|
||||||
|
cur->properties = NULL;
|
||||||
|
cur->nsDef = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cur->content = xmlStrncat(cur->content, content, len);
|
cur->content = xmlStrncat(cur->content, content, len);
|
||||||
@ -5903,7 +5915,8 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
|
|||||||
xmlAttrPtr prop;
|
xmlAttrPtr prop;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
if ((node == NULL) || (name == NULL)) return(NULL);
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
|
return(NULL);
|
||||||
/*
|
/*
|
||||||
* Check on the properties attached to the node
|
* Check on the properties attached to the node
|
||||||
*/
|
*/
|
||||||
@ -5959,7 +5972,7 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
|||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
#endif /* LIBXML_TREE_ENABLED */
|
#endif /* LIBXML_TREE_ENABLED */
|
||||||
|
|
||||||
if (node == NULL)
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
prop = node->properties;
|
prop = node->properties;
|
||||||
@ -6057,7 +6070,9 @@ xmlGetProp(xmlNodePtr node, const xmlChar *name) {
|
|||||||
xmlAttrPtr prop;
|
xmlAttrPtr prop;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
if ((node == NULL) || (name == NULL)) return(NULL);
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check on the properties attached to the node
|
* Check on the properties attached to the node
|
||||||
*/
|
*/
|
||||||
@ -6114,7 +6129,8 @@ xmlGetNoNsProp(xmlNodePtr node, const xmlChar *name) {
|
|||||||
xmlAttrPtr prop;
|
xmlAttrPtr prop;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
if ((node == NULL) || (name == NULL)) return(NULL);
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
|
return(NULL);
|
||||||
/*
|
/*
|
||||||
* Check on the properties attached to the node
|
* Check on the properties attached to the node
|
||||||
*/
|
*/
|
||||||
@ -6172,7 +6188,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
|||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
|
|
||||||
if (node == NULL)
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
prop = node->properties;
|
prop = node->properties;
|
||||||
@ -6236,7 +6252,7 @@ int
|
|||||||
xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
|
xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
|
||||||
xmlAttrPtr prop, prev = NULL;;
|
xmlAttrPtr prop, prev = NULL;;
|
||||||
|
|
||||||
if ((node == NULL) || (name == NULL))
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
return(-1);
|
return(-1);
|
||||||
prop = node->properties;
|
prop = node->properties;
|
||||||
while (prop != NULL) {
|
while (prop != NULL) {
|
||||||
@ -6265,7 +6281,7 @@ int
|
|||||||
xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
|
xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
|
||||||
xmlAttrPtr prop, prev = NULL;;
|
xmlAttrPtr prop, prev = NULL;;
|
||||||
|
|
||||||
if ((node == NULL) || (name == NULL))
|
if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || (name == NULL))
|
||||||
return(-1);
|
return(-1);
|
||||||
prop = node->properties;
|
prop = node->properties;
|
||||||
if (ns == NULL)
|
if (ns == NULL)
|
||||||
@ -6471,12 +6487,14 @@ xmlTextConcat(xmlNodePtr node, const xmlChar *content, int len) {
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
/* need to check if content is currently in the dictionary */
|
/* need to check if content is currently in the dictionary */
|
||||||
if ((node->doc != NULL) && (node->doc->dict != NULL) &&
|
if ((node->content == (xmlChar *) &(node->properties)) ||
|
||||||
xmlDictOwns(node->doc->dict, node->content)) {
|
((node->doc != NULL) && (node->doc->dict != NULL) &&
|
||||||
|
xmlDictOwns(node->doc->dict, node->content))) {
|
||||||
node->content = xmlStrncatNew(node->content, content, len);
|
node->content = xmlStrncatNew(node->content, content, len);
|
||||||
} else {
|
} else {
|
||||||
node->content = xmlStrncat(node->content, content, len);
|
node->content = xmlStrncat(node->content, content, len);
|
||||||
}
|
}
|
||||||
|
node->properties = NULL;
|
||||||
if (node->content == NULL)
|
if (node->content == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
return(0);
|
return(0);
|
||||||
|
48
valid.c
48
valid.c
@ -5860,24 +5860,12 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
|||||||
NULL,NULL,NULL);
|
NULL,NULL,NULL);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if (elem->properties != NULL) {
|
|
||||||
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
|
||||||
"Text element has attribute !\n",
|
|
||||||
NULL,NULL,NULL);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if (elem->ns != NULL) {
|
if (elem->ns != NULL) {
|
||||||
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
||||||
"Text element has namespace !\n",
|
"Text element has namespace !\n",
|
||||||
NULL,NULL,NULL);
|
NULL,NULL,NULL);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
if (elem->nsDef != NULL) {
|
|
||||||
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
|
||||||
"Text element has namespace !\n",
|
|
||||||
NULL,NULL,NULL);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if (elem->content == NULL) {
|
if (elem->content == NULL) {
|
||||||
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
|
||||||
"Text element has no content !\n",
|
"Text element has no content !\n",
|
||||||
@ -6302,23 +6290,25 @@ xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret &= xmlValidateOneElement(ctxt, doc, elem);
|
ret &= xmlValidateOneElement(ctxt, doc, elem);
|
||||||
attr = elem->properties;
|
if (elem->type == XML_ELEMENT_NODE) {
|
||||||
while (attr != NULL) {
|
attr = elem->properties;
|
||||||
value = xmlNodeListGetString(doc, attr->children, 0);
|
while (attr != NULL) {
|
||||||
ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
|
value = xmlNodeListGetString(doc, attr->children, 0);
|
||||||
if (value != NULL)
|
ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
|
||||||
xmlFree((char *)value);
|
if (value != NULL)
|
||||||
attr= attr->next;
|
xmlFree((char *)value);
|
||||||
}
|
attr= attr->next;
|
||||||
ns = elem->nsDef;
|
}
|
||||||
while (ns != NULL) {
|
ns = elem->nsDef;
|
||||||
if (elem->ns == NULL)
|
while (ns != NULL) {
|
||||||
ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
|
if (elem->ns == NULL)
|
||||||
ns, ns->href);
|
ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
|
||||||
else
|
ns, ns->href);
|
||||||
ret &= xmlValidateOneNamespace(ctxt, doc, elem, elem->ns->prefix,
|
else
|
||||||
ns, ns->href);
|
ret &= xmlValidateOneNamespace(ctxt, doc, elem,
|
||||||
ns = ns->next;
|
elem->ns->prefix, ns, ns->href);
|
||||||
|
ns = ns->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
child = elem->children;
|
child = elem->children;
|
||||||
while (child != NULL) {
|
while (child != NULL) {
|
||||||
|
@ -196,7 +196,7 @@ static const char *pattern = NULL;
|
|||||||
static xmlPatternPtr patternc = NULL;
|
static xmlPatternPtr patternc = NULL;
|
||||||
static xmlStreamCtxtPtr patstream = NULL;
|
static xmlStreamCtxtPtr patstream = NULL;
|
||||||
#endif
|
#endif
|
||||||
static int options = 0;
|
static int options = XML_PARSE_COMPACT;
|
||||||
static int sax = 0;
|
static int sax = 0;
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -2793,6 +2793,7 @@ static void usage(const char *name) {
|
|||||||
printf("\t--path 'paths': provide a set of paths for resources\n");
|
printf("\t--path 'paths': provide a set of paths for resources\n");
|
||||||
printf("\t--load-trace : print trace of all external entites loaded\n");
|
printf("\t--load-trace : print trace of all external entites loaded\n");
|
||||||
printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
|
printf("\t--nonet : refuse to fetch DTDs or entities over network\n");
|
||||||
|
printf("\t--nocompact : do not generate compact text nodes\n");
|
||||||
printf("\t--htmlout : output results as HTML\n");
|
printf("\t--htmlout : output results as HTML\n");
|
||||||
printf("\t--nowrap : do not put HTML doc wrapper\n");
|
printf("\t--nowrap : do not put HTML doc wrapper\n");
|
||||||
#ifdef LIBXML_VALID_ENABLED
|
#ifdef LIBXML_VALID_ENABLED
|
||||||
@ -3175,6 +3176,9 @@ main(int argc, char **argv) {
|
|||||||
} else if ((!strcmp(argv[i], "-nonet")) ||
|
} else if ((!strcmp(argv[i], "-nonet")) ||
|
||||||
(!strcmp(argv[i], "--nonet"))) {
|
(!strcmp(argv[i], "--nonet"))) {
|
||||||
options |= XML_PARSE_NONET;
|
options |= XML_PARSE_NONET;
|
||||||
|
} else if ((!strcmp(argv[i], "-nocompact")) ||
|
||||||
|
(!strcmp(argv[i], "--nocompact"))) {
|
||||||
|
options &= ~XML_PARSE_COMPACT;
|
||||||
} else if ((!strcmp(argv[i], "-load-trace")) ||
|
} else if ((!strcmp(argv[i], "-load-trace")) ||
|
||||||
(!strcmp(argv[i], "--load-trace"))) {
|
(!strcmp(argv[i], "--load-trace"))) {
|
||||||
load_trace++;
|
load_trace++;
|
||||||
|
16
xmlreader.c
16
xmlreader.c
@ -348,7 +348,8 @@ xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) {
|
|||||||
(cur->type == XML_XINCLUDE_END)) &&
|
(cur->type == XML_XINCLUDE_END)) &&
|
||||||
(cur->properties != NULL))
|
(cur->properties != NULL))
|
||||||
xmlTextReaderFreePropList(reader, cur->properties);
|
xmlTextReaderFreePropList(reader, cur->properties);
|
||||||
if ((cur->type != XML_ELEMENT_NODE) &&
|
if ((cur->content != (xmlChar *) &(cur->properties)) &&
|
||||||
|
(cur->type != XML_ELEMENT_NODE) &&
|
||||||
(cur->type != XML_XINCLUDE_START) &&
|
(cur->type != XML_XINCLUDE_START) &&
|
||||||
(cur->type != XML_XINCLUDE_END) &&
|
(cur->type != XML_XINCLUDE_END) &&
|
||||||
(cur->type != XML_ENTITY_REF_NODE)) {
|
(cur->type != XML_ENTITY_REF_NODE)) {
|
||||||
@ -422,7 +423,8 @@ xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) {
|
|||||||
(cur->type == XML_XINCLUDE_END)) &&
|
(cur->type == XML_XINCLUDE_END)) &&
|
||||||
(cur->properties != NULL))
|
(cur->properties != NULL))
|
||||||
xmlTextReaderFreePropList(reader, cur->properties);
|
xmlTextReaderFreePropList(reader, cur->properties);
|
||||||
if ((cur->type != XML_ELEMENT_NODE) &&
|
if ((cur->content != (xmlChar *) &(cur->properties)) &&
|
||||||
|
(cur->type != XML_ELEMENT_NODE) &&
|
||||||
(cur->type != XML_XINCLUDE_START) &&
|
(cur->type != XML_XINCLUDE_START) &&
|
||||||
(cur->type != XML_XINCLUDE_END) &&
|
(cur->type != XML_XINCLUDE_END) &&
|
||||||
(cur->type != XML_ENTITY_REF_NODE)) {
|
(cur->type != XML_ENTITY_REF_NODE)) {
|
||||||
@ -2810,7 +2812,9 @@ xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader) {
|
|||||||
reader->faketext = xmlNewDocText(reader->node->doc,
|
reader->faketext = xmlNewDocText(reader->node->doc,
|
||||||
ns->href);
|
ns->href);
|
||||||
} else {
|
} else {
|
||||||
if (reader->faketext->content != NULL)
|
if ((reader->faketext->content != NULL) &&
|
||||||
|
(reader->faketext->content !=
|
||||||
|
(xmlChar *) &(reader->faketext->properties)))
|
||||||
xmlFree(reader->faketext->content);
|
xmlFree(reader->faketext->content);
|
||||||
reader->faketext->content = xmlStrdup(ns->href);
|
reader->faketext->content = xmlStrdup(ns->href);
|
||||||
}
|
}
|
||||||
@ -4776,6 +4780,12 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
|
|||||||
if (reader == NULL)
|
if (reader == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we force the generation of compact text nodes on the reader
|
||||||
|
* since usr applications should never modify the tree
|
||||||
|
*/
|
||||||
|
options |= XML_PARSE_COMPACT;
|
||||||
|
|
||||||
reader->doc = NULL;
|
reader->doc = NULL;
|
||||||
reader->entNr = 0;
|
reader->entNr = 0;
|
||||||
reader->parserFlags = options;
|
reader->parserFlags = options;
|
||||||
|
Reference in New Issue
Block a user