Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Bes XPath query? [Thread Next] Re: Bes XPath query?To: NULL Date: 5/8/2009 7:04:00 PM 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/documentation/Cocoa/Conceptual/NSXML_Concepts/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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
