Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Bes XPath query?

From: Martin Honnen <mahotrash@-----.-->
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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent