CxT wrote:
> On May 8, 8:52 am, Martin Honnen <mahotr...@yahoo.de> wrote:
>
>> So that is XHTML and that means, if the document is parsed by an XML
>> parser, that you need to bind a prefix to the namespace URI and use that
>> prefix in your XPath expressions.
>
> Could you please provide an example of what such an expression would
> look like?
The XPath API needs to provide a way to bind a prefix to a namespace
URI. Assuming we have bound the prefix 'xhtml' to
'http://www.w3.org/1999/xhtml' any XPath expression would then use the
prefix to qualify element names e.g.
/xhtml:html/xhtml:body//xhtml:table
> I am using NSXML under Cocoa/Objective-C (Mac OS X).
I don't know that one. The documentation
http://developer.apple.com/documenta...pts/NSXML.html
says it supports both XQuery and XPath.
If it really supports XQuery 1.0 then you might be able to avoid the
prefix and do
declare default element namespace "http://www.w3.org/1999/xhtml";
/html/body//table
But that all does not explain why some XPath expressions worked without
any prefix and other did not work. I am afraid you need to find some
forum/newsgroup/mailing list dealing with NSXML, unless someone here
comes along that knows NSXML.
I tried that URL you provided with Saxon 9's XQuery implementation but
it reports an XML parse error so it is not even able to build a data
model from that document.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/