Re: XPath expression prefixes
Martin Honnen <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xml |
|---|---|
| Organization | Liberty Development |
| Message-ID | <[email protected]> |
[email protected] wrote: > <<Continued from yesterday>> > > I finally have my selectNodes function working. The only problem is > that I always have to use a prefix in my XPath expression, for example > "//ws:MasterRow". This prefix causes problems in IE however. That sounds more like you are not using XPath in IE, make sure you are using IE 6 or you use IE 5/5.5 with MSXML 3 or later and you call xmlDocument.setProperty('SelectionLanguage', 'XPath') before you use selectNodes/selectSingleNode as otherwise you are not using XPath 1.0 but some other selection language that MS implemented before they implemented the W3C recommendation XPath 1.0. And of course with MSXML if you want to use prefixes in XPath expression you have to declare them e.g. xmlDocument.setProperty('SelectionNamespaces', 'xmlns:pf1="http://example.com/ns1" xmlns:pf2="http://example.org/ns"'); > Can I use > XPath in Mozilla on a Soap document without using prefixes in my XPath > expression? Sure //* for instance or //@* will work but of course if you want to match elements in a namespace then you need to use prefixes or inefficient workarounds like //*[local-name() = 'Mastercolumn'] -- Martin Honnen http://JavaScript.FAQTs.com/