SV: SV: [jdom-interest] Can't get values using xpath

Per Norrman pernorrman at telia.com
Mon Oct 27 15:43:55 PST 2003


But you don't have to. All elements in the
xml data you receive belongs to the namespace
http://nc3pc4.sch.advantis.com/XMLSchema/API, but
the xml uses no prefix. OK.

When you construct the XPath expression, you must use
a prefix to tell the XPath processor that some, or in this case, all, 
elements belongs to a certain namespace.

The XPath processor does not compare prefixes, it compares
namespace URIs.

Try my suggestion, it works. I promise.

/pmn


> -----Ursprungligt meddelande-----
> Från: jdom-interest-admin at jdom.org 
> [mailto:jdom-interest-admin at jdom.org] För Abhijeet Sarwate
> Skickat: den 28 oktober 2003 00:19
> Till: Per Norrman
> Kopia: 'John Hurst'; jdom-interest at jdom.org
> Ämne: Re: SV: [jdom-interest] Can't get values using xpath
> 
> 
> Thanks to both of you, but I can't modify the xml received
> 
> Per Norrman wrote:
> 
> >Hi,
> >
> >a third approach:
> >
> >Use this XPath expression
> >
> >       "/x:APIInterface/x:StoreSiteResponse/x:ReturnCode
> >
> >The construct the XPath object as:
> >        XPath xp = XPath.newInstance(xpath);
> >        xp.addNamespace(Namespace.getNamespace("x", 
"http://......."));
>        Element e = (Element)xp.selectSingleNode(requestDoc);
>
>/pmn
>
>
>  
>

-- 

Abhijeet Sarwate
DBOR
AT & T Middletown
732-420-2804

-----------
If you Don’t Ask, you Don’t Get, But if you Do, you Do !


_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list