[xml] node() xpath and entity ref nodes



Hi,

I have an xml like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY greeting "ahoy">
]>
<root>
        <value>&greeting;</value>
        <value>Today, our greeting is &greeting;</value>
</root>

And xpath count(/root/value/node()) returns 1. It ignores the two entity reference nodes, I think it should 
return 3.

If I am right, following (also attached) patch (based on master branch) fixes it.

diff --git c/xpath.c w/xpath.c
index dc41ce6..a8b1f76 100644
--- c/xpath.c
+++ w/xpath.c
@@ -12398,6 +12398,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
                            case XML_CDATA_SECTION_NODE:
                            case XML_TEXT_NODE:
                            case XML_NAMESPACE_DECL:
+                           case XML_ENTITY_REF_NODE:
                                XP_TEST_HIT
                                break;
                            default:

Vojtech

Attachment: vfr01_node-test-node-entity-refs.patch
Description: vfr01_node-test-node-entity-refs.patch



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]