Re: Keyboard Navigation Code - XPathEvaluate - need help

"Ady Shimony" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <ctq291$1j72__30328.8417905152$1107332551$gmane$org@ripley.netscape.com>
Thanks Martin

My XUL looks like this

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/css/default_PC.css" type="text/css"?>
<window width="602" height="452" style="background: #FFFFFF;" 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
title="Screen2" UserEdit="yes" align="left">
<stack>
<button id="Button1" width="80" height="28" left="44" top="41" 
style="background: #5F6BA7;border-color: #6E7AB0;" label="My 
Button"></button>
<button id="Button2" width="80" height="28" left="155" top="40" 
style="background: #5F6BA7;border-color: #6E7AB0;" label="My 
Button"></button>
<button id="Button3" width="80" height="28" left="249" top="37" 
style="background: #5F6BA7;border-color: #6E7AB0;" label="My 
Button"></button>
</stack>
</window>

I don't understand how to make the resolver undertand ?

Thanks, Ady


"Martin Honnen" <[email protected]> wrote in message 
news:[email protected]...
>
>
> Ady Shimony wrote:
>
>
>> The problem is in this code that from some reason don't work under XUL 
>> files.
>>
>> var path = '//a[@href] | //select |  //button | 
>> //input[not(@type="hidden")] | //textarea';
>>
>> var resolver = doc.createNSResolver(doc.documentElement);
>>
>> var xpathResult = doc.evaluate(path, doc.documentElement, resolver, 
>> XPathResult.ORDERED_NODE_ITERATOR_TYPE , null);
>>
>> XpathResult returns nothing under XUL files, return all elements in HTML
>>
>> What am I doing wrong here?
>
> How does the example XUL exactly look?
> XUL is XML and XUL elements are in the XUL namespace (and HTML elements in 
> the XHTML namespace probably if HTML elements are used inside of XUL docs) 
> so you likely need to make sure your resolver correctly resolves the 
> namespaces and your XPath expression uses namespace prefixes even if the 
> elements are in the default namespace (e.g. <window xmlns="...">) as XPath 
> expression don't know about default namespaces meaning
>   window
> as an XPath expression matches <window> elements (null namespace) but not 
> <window xmlns="http://example.com/2005/02/ws"> for instance, for that you 
> need to make sure you use a prefix in your XPath bound to the namespace 
> URI e.g. if your resolver resolves 'ws' to 'http://example.com/2005/02/ws' 
> then the XPath
>   ws:window
> matches.
>
> -- 
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.