mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
- bux fixes in XPath implementation
- fixed xml-config --version - updated TODO Daniel
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
Mon Jan 24 14:31:09 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
|
* xml-config.in: xml-config --version to just return the
|
||||||
|
version number
|
||||||
|
* xpath.c: some cleanup w.r.t. axis when the current node is
|
||||||
|
an attribute.
|
||||||
|
* TODO: updated
|
||||||
|
|
||||||
Tue Jan 18 18:46:06 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
Tue Jan 18 18:46:06 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||||
|
|
||||||
* configure.in: prepared for libxml-1.8.5
|
* configure.in: prepared for libxml-1.8.5
|
||||||
|
4
TODO
4
TODO
@ -86,6 +86,10 @@ TODO:
|
|||||||
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
|
- dynamically adapt the alloc entry point to use g_alloc()/g_free()
|
||||||
if the programmer wants it
|
if the programmer wants it
|
||||||
|
|
||||||
|
- I18N: http://wap.trondheim.com/vaer/index.phtml is not XML and accepted
|
||||||
|
by the XML parser, UTF-8 should be checked when there is no "encoding"
|
||||||
|
declared !
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
=====
|
=====
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ while test $# -gt 0; do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
--version)
|
--version)
|
||||||
echo @PACKAGE@ @VERSION@
|
echo @VERSION@
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
145
xpath.c
145
xpath.c
@ -1488,10 +1488,26 @@ xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
if ((ctxt->context->node->type == XML_DOCUMENT_NODE) ||
|
if (ctxt->context->node == NULL) return(NULL);
|
||||||
(ctxt->context->node->type == XML_HTML_DOCUMENT_NODE))
|
switch (ctxt->context->node->type) {
|
||||||
return(((xmlDocPtr) ctxt->context->node)->root);
|
case XML_ELEMENT_NODE:
|
||||||
return(ctxt->context->node->childs);
|
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:
|
||||||
|
return(ctxt->context->node->childs);
|
||||||
|
case XML_ATTRIBUTE_NODE:
|
||||||
|
return(NULL);
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
|
case XML_DOCUMENT_TYPE_NODE:
|
||||||
|
case XML_DOCUMENT_FRAG_NODE:
|
||||||
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
|
return(((xmlDocPtr) ctxt->context->node)->root);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
if ((cur->type == XML_DOCUMENT_NODE) ||
|
if ((cur->type == XML_DOCUMENT_NODE) ||
|
||||||
(cur->type == XML_HTML_DOCUMENT_NODE))
|
(cur->type == XML_HTML_DOCUMENT_NODE))
|
||||||
@ -1513,6 +1529,11 @@ xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
|
if (ctxt->context->node == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (ctxt->context->node->type == XML_ATTRIBUTE_NODE)
|
||||||
|
return(NULL);
|
||||||
|
|
||||||
if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
|
if (ctxt->context->node == (xmlNodePtr) ctxt->context->doc)
|
||||||
return(ctxt->context->doc->root);
|
return(ctxt->context->doc->root);
|
||||||
return(ctxt->context->node->childs);
|
return(ctxt->context->node->childs);
|
||||||
@ -1548,24 +1569,15 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
*/
|
*/
|
||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
if (cur == NULL)
|
if (cur == NULL) {
|
||||||
|
if (ctxt->context->node == NULL)
|
||||||
|
return(NULL);
|
||||||
|
if (ctxt->context->node->type == XML_ATTRIBUTE_NODE)
|
||||||
|
return(NULL);
|
||||||
return(ctxt->context->node);
|
return(ctxt->context->node);
|
||||||
|
}
|
||||||
|
|
||||||
if (cur == (xmlNodePtr) ctxt->context->doc)
|
return(xmlXPathNextDescendant(ctxt, cur));
|
||||||
return(ctxt->context->doc->root);
|
|
||||||
if (cur->childs != NULL) return(cur->childs);
|
|
||||||
if (cur->next != NULL) return(cur->next);
|
|
||||||
|
|
||||||
do {
|
|
||||||
cur = cur->parent;
|
|
||||||
if (cur == NULL) return(NULL);
|
|
||||||
if (cur == ctxt->context->node) return(NULL);
|
|
||||||
if (cur->next != NULL) {
|
|
||||||
cur = cur->next;
|
|
||||||
return(cur);
|
|
||||||
}
|
|
||||||
} while (cur != NULL);
|
|
||||||
return(cur);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1581,14 +1593,35 @@ xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
/*
|
/*
|
||||||
* !!!!!!!!!!!!!
|
|
||||||
* the parent of an attribute or namespace node is the element
|
* the parent of an attribute or namespace node is the element
|
||||||
* to which the attribute or namespace node is attached
|
* to which the attribute or namespace node is attached
|
||||||
|
* Namespace handling !!!
|
||||||
*/
|
*/
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
if (ctxt->context->node->parent == NULL)
|
if (ctxt->context->node == NULL) return(NULL);
|
||||||
return((xmlNodePtr) ctxt->context->doc);
|
switch (ctxt->context->node->type) {
|
||||||
return(ctxt->context->node->parent);
|
case XML_ELEMENT_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:
|
||||||
|
if (ctxt->context->node->parent == NULL)
|
||||||
|
return((xmlNodePtr) ctxt->context->doc);
|
||||||
|
return(ctxt->context->node->parent);
|
||||||
|
case XML_ATTRIBUTE_NODE: {
|
||||||
|
xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
|
||||||
|
|
||||||
|
return(att->node);
|
||||||
|
}
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
|
case XML_DOCUMENT_TYPE_NODE:
|
||||||
|
case XML_DOCUMENT_FRAG_NODE:
|
||||||
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -1610,20 +1643,63 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
/*
|
/*
|
||||||
* !!!!!!!!!!!!!
|
|
||||||
* the parent of an attribute or namespace node is the element
|
* the parent of an attribute or namespace node is the element
|
||||||
* to which the attribute or namespace node is attached
|
* to which the attribute or namespace node is attached
|
||||||
|
* !!!!!!!!!!!!!
|
||||||
*/
|
*/
|
||||||
if (cur == NULL) {
|
if (cur == NULL) {
|
||||||
if (ctxt->context->node->parent == NULL)
|
if (ctxt->context->node == NULL) return(NULL);
|
||||||
return((xmlNodePtr) ctxt->context->doc);
|
switch (ctxt->context->node->type) {
|
||||||
return(ctxt->context->node->parent);
|
case XML_ELEMENT_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:
|
||||||
|
if (ctxt->context->node->parent == NULL)
|
||||||
|
return((xmlNodePtr) ctxt->context->doc);
|
||||||
|
return(ctxt->context->node->parent);
|
||||||
|
case XML_ATTRIBUTE_NODE: {
|
||||||
|
xmlAttrPtr cur = (xmlAttrPtr) ctxt->context->node;
|
||||||
|
|
||||||
|
return(cur->node);
|
||||||
|
}
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
|
case XML_DOCUMENT_TYPE_NODE:
|
||||||
|
case XML_DOCUMENT_FRAG_NODE:
|
||||||
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
if (cur == ctxt->context->doc->root)
|
if (cur == ctxt->context->doc->root)
|
||||||
return((xmlNodePtr) ctxt->context->doc);
|
return((xmlNodePtr) ctxt->context->doc);
|
||||||
if (cur == (xmlNodePtr) ctxt->context->doc)
|
if (cur == (xmlNodePtr) ctxt->context->doc)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(cur->parent);
|
switch (cur->type) {
|
||||||
|
case XML_ELEMENT_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:
|
||||||
|
return(cur->parent);
|
||||||
|
case XML_ATTRIBUTE_NODE: {
|
||||||
|
xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
|
||||||
|
|
||||||
|
return(att->node);
|
||||||
|
}
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
|
case XML_DOCUMENT_TYPE_NODE:
|
||||||
|
case XML_DOCUMENT_FRAG_NODE:
|
||||||
|
case XML_HTML_DOCUMENT_NODE:
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1641,18 +1717,9 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
|||||||
*/
|
*/
|
||||||
xmlNodePtr
|
xmlNodePtr
|
||||||
xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
|
||||||
/*
|
|
||||||
* !!!!!!!!!!!!!
|
|
||||||
* the parent of an attribute or namespace node is the element
|
|
||||||
* to which the attribute or namespace node is attached
|
|
||||||
*/
|
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
return(ctxt->context->node);
|
return(ctxt->context->node);
|
||||||
if (cur == ctxt->context->doc->root)
|
return(xmlXPathNextAncestor(ctxt, cur));
|
||||||
return((xmlNodePtr) ctxt->context->doc);
|
|
||||||
if (cur == (xmlNodePtr) ctxt->context->doc)
|
|
||||||
return(NULL);
|
|
||||||
return(cur->parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user