[REXML] Looking for XPath testers

(Tobi Reif) #1

Sean Russell wrote:

Namespaces are supported, but only on the default namespaces. IE,

    d = Document.new("<a x='foo'><b/><x:b/></a>")
    xpath.match( d, '//x:b' )

will only return the second ‘b’ element, as it should, but there is as yet
no mechanism for remapping the namespaces.

For documents that I din’t create I don’t know which prefix stands for
which Namespace. So I read in a doc, and I know there are elements of
the namespace [URI], and I need to match those, then the (existing)
mechanism matching them via the URI is important (prefixes are very
irrelevant for the namespace concept; they are a just a lowlevel
shorthand mechanism, where some string stands for a longer string. Any
prefix string can be chosen for a given URI). Currently, I can declare
my own prefix-URI mapping for my XPath queries (this shouldn’t remap any
of the document’s declarations; does it?), and thus match elements&attrs
by namespace URI. It is important that this will be available in the new
(I also want to be able to create elements of a namespace given by a
URI, and REXML should generate the NS declarations and prefixes when
serializing this to a document. Big wish :slight_smile: )

BTW “default namespaces” stands for stuff that’s declared like
xmlns=“URI” instead of xmlns:foo=“URI”.