Stanislaw Wozniak <stan / wozniak.com> wrote:

> Hi, this was a typo, no semicolon in there:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration-data
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:company:platform:foundation:configuration:defn:v1"
> xmlns="urn:company:platform:foundation:configuration:defn:v1">
> <attributeList>
> <attribute name="siteid" validationRuleName="String" description="Site
> id">
> <tree name="siteid_hierarchy">
> <treenode name="Root">
> <treenode name="1" />
> </treenode>
> </tree>
> </attribute>
> </attributeList>
> </configuration-data>

Then what's the problem? XPath works:

s = <<END
<?xml version="1.0" encoding="UTF-8"?>
<configuration-data
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:company:platform:foundation:configuration:defn:v
1"
xmlns="urn:company:platform:foundation:configuration:defn:v1">
<attributeList>
<attribute name="siteid" validationRuleName="String" description="Site
id">
<tree name="siteid_hierarchy">
<treenode name="Root">
<treenode name="1" />
</treenode>
</tree>
</attribute>
</attributeList>
</configuration-data>
END
require 'rexml/document'
include REXML
doc = Document.new(s)
p XPath.match(doc, "//treenode['Root']/treenode")
#=> [<treenode name='1'/>]

Oh, wait, you said you were using libxml:

s = <<END
<?xml version="1.0" encoding="UTF-8"?>
<configuration-data>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:company:platform:foundation:configuration:defn:v
1"
xmlns="urn:company:platform:foundation:configuration:defn:v1">
<attributeList>
<attribute name="siteid" validationRuleName="String" description="Site
id">
<tree name="siteid_hierarchy">
<treenode name="Root">
<treenode name="1" />
</treenode>
</tree>
</attribute>
</attributeList>
</configuration-data>
END
require 'rubygems'
require 'xml'
doc = XML::Document.string(s)
doc.find("//treenode['Root']/treenode").each do |el|
  p el #=> <treenode name="1"/>
end

Sorry, I'm failing to guess what problem you're having. Perhaps if you
showed your actual code? m.