logo       

LibXML: Solution Found to XPath and Schema "default namespace" files.: msg#00085

lang.perl.xml

Subject: LibXML: Solution Found to XPath and Schema "default namespace" files.

Hi,

Sorry for the question. I found the answer by looking around with Google
(nothing on this list archive that was obvious).

The problem was that my xpath queries wouldn't find anything in an xml
file set with a default namespace.

The solution was to use:

root->setNamespace($NamespaceURI,'foo',1)

to set the document root element with a non-null prefix and then use this
prefix in the xpath queries. The above command will change things so that
xpath can query the "in memory" nodes that now have a non-null namespace
prefix.

@nodelist = findnodes('//foo:someelement');

Definitely NON-OBVIOUS...

Thanks be to Google!

Les Richardson
Open Admin for Schools

_______________________________________________
Perl-XML mailing list
Perl-XML@xxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise