Re: [xml] XPath evaluation
- From: Nic <nferrier tapsellferrier co uk>
- To: "CAPRON Patrick" <capronpa e-i com>
- Cc: xml gnome org, AUFFRAY Gilles <auffragi e-i com>
- Subject: Re: [xml] XPath evaluation
- Date: Wed, 26 Apr 2006 13:51:55 +0100
"CAPRON Patrick" <capronpa e-i com> writes:
Hi,
I don't understand how libxml2 is evaluating some expressions.
I have an XML who looks like :
<?xml version="1.0"?>
<REQUEST>
<HEADER/>
<CODEAPPLI>TARGET2</CODEAPPLI>
<BICCOR>CMCIFRPP</BICCOR>
<NMSRVLOG>NMSRVLOG</NMSRVLOG>
<NMRQTLOG>NMRQTLOG</NMRQTLOG>
<REQUESTREF>REQUESTREF</REQUESTREF>
<RQTSTATUS>RQTSTATUS</RQTSTATUS>
<SwInt:RequestPayload>
<AppHdr xmlns="urn:ssp.ApplicationHeader$ahV10">
<From>
<Type>NAME</Type>
<Id>PM</Id>
</From>
<To>
<Type>NAME</Type>
<Id>PM</Id>
</To>
<MsgRef>ABCDEF</MsgRef>
<CrDate>2006-04-19T12:00:00</CrDate>
</AppHdr>
<Document xmlns="urn:ssp.pm.GetLimit$camt.009.001.02">
<camt.009.001.02>
<MsgId>
<Id>REFERENCE12345</Id>
</MsgId>
<LmtQryDef>
<LmtCrit>
<NewCrit>
<SchCrit>
<AcctOwnr>CMCIFRPAXXX</AcctOwnr>
</SchCrit>
</NewCrit>
</LmtCrit>
</LmtQryDef>
</camt.009.001.02>
</Document>
</SwInt:RequestPayload>
</REQUEST>
I use the xmlXPathEvalExpression function.
If I use the expression : /REQUEST/RequestPayload/Document the function returns 0 node.
If I use the expression : /REQUEST/RequestPayload/*[name()='Document'] it returns the node I'm
looking for.
Could anybody explain me why there is a difference between this two expressions ?
I believed that they were the same...
Is it because of the xmlns ?
Yes, I think so.
But I don't know why the second one matches at all because
RequestPayload isn't in an empty namespace either; so I expected it to
match if you did:
/REQUEST/SwInt:RequestPayload:urn:ssp.pm.GetLimit$camt.009.001.02:Document
To get xpath to match this you could register the namespaces with tags
and then eval the expressions.
Nic Ferrier
http://www.tapsellferrier.co.uk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]