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

Abhijeet Sarwate asarwate at elm.mt.att.com
Tue Oct 28 07:26:09 PST 2003


Hi,

thanx , it works

abhijeet

Per Norrman wrote:

>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 !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20031028/e8016a34/attachment.htm


More information about the jdom-interest mailing list