XPath select node with periods

I have an XML document in which some of the nodes have .in their name:

<com.site.blah>
   <id>asdkjasd</id>
   <com.site.testing>
       <name>test</name>
    </com.site.testing>
</com.site.blah>

If I try @doc.search("/*/id").first.xpath, he will return /com.site.blah/id, but if I then do:, @doc.search("/com.site.blah/id").first.inspecthe will return nil.

I want the XPath request to be able to select a name under com.site.testing, but it continues to reject my requests.

Any ideas?

(I use hpricot if that matters)

+5
source share
1 answer

XPath . XPath - QName (http://www.w3.org/TR/xpath/#NT-NameTest), EBNF (http://www.w3.org/TR/REC-xml/#NT-NameChar). .

, , XPath, , :

/*[name(.) = 'com.site.blah']/id
+2

All Articles