"CAPRON Patrick" <[EMAIL PROTECTED]> 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 _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
