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
diff --git a/valid.c b/valid.c
index 35c21ae..c0141ff 100644
--- a/valid.c
+++ b/valid.c
@@ -5860,24 +5860,12 @@
NULL,NULL,NULL);
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) {
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
"Text element has namespace !\n",
NULL,NULL,NULL);
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) {
xmlErrValidNode(ctxt, elem, XML_ERR_INTERNAL_ERROR,
"Text element has no content !\n",
@@ -6302,23 +6290,25 @@
}
ret &= xmlValidateOneElement(ctxt, doc, elem);
- attr = elem->properties;
- while (attr != NULL) {
- value = xmlNodeListGetString(doc, attr->children, 0);
- ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
- if (value != NULL)
- xmlFree((char *)value);
- attr= attr->next;
- }
- ns = elem->nsDef;
- while (ns != NULL) {
- if (elem->ns == NULL)
- ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
- ns, ns->href);
- else
- ret &= xmlValidateOneNamespace(ctxt, doc, elem, elem->ns->prefix,
- ns, ns->href);
- ns = ns->next;
+ if (elem->type == XML_ELEMENT_NODE) {
+ attr = elem->properties;
+ while (attr != NULL) {
+ value = xmlNodeListGetString(doc, attr->children, 0);
+ ret &= xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
+ if (value != NULL)
+ xmlFree((char *)value);
+ attr= attr->next;
+ }
+ ns = elem->nsDef;
+ while (ns != NULL) {
+ if (elem->ns == NULL)
+ ret &= xmlValidateOneNamespace(ctxt, doc, elem, NULL,
+ ns, ns->href);
+ else
+ ret &= xmlValidateOneNamespace(ctxt, doc, elem,
+ elem->ns->prefix, ns, ns->href);
+ ns = ns->next;
+ }
}
child = elem->children;
while (child != NULL) {