Absolute locations and attributes in xmerl_xpath.

Rudolph van Graan rvg@REDACTED
Mon Mar 8 19:12:32 CET 2004


Hi Enrique,

I've found the same problem last week, the quick solution for me was 
not to use "/AAA" to get to the root, but rather "./". It worked - I 
didn't have the time to find out why the normal case didn't work.

Regards,

Rudolph van Graan

On Mar 8, 2004, at 1:35 PM, Enrique Marcote Peña wrote:

> Hi,
>
> I've been trying... but I can't figure it out myself.  Could anyone 
> send me an
> example on how to use absolute paths with xmerl_xpath?  In a previous 
> post I
> saw the solution was
>
>     "to have XPATH wrap the XML structure returned by
>      xmerl_scan with an #xmerlDocument{} (or similar) record."
>
> But don't know how to do it.  Here's the sample
>
> XPath expression: "/AAA"
>
> XML document:
>
> <?xml version="1.0"?>
> <AAA>
>   <BBB/>
>   <CCC/>
>   <BBB/>
>   <BBB/>
>   <DDD>
>     <BBB/>
>   </DDD>
>   <CCC/>
> </AAA>
>
> I've tried to assign the value returned by xmerl_scan to the content 
> field of
> a #xmlDocument{} record with no joy.
>
>     E = xmerl_scan:file(FileName, [{space, normalize}]),
>     XmlDocument = % ???
>     xmerl_xpath:string("/AAA", XmlDocument).
>
> I always get an empty list. Could anyone give me a detailed example? 
> (please
> excuse my clumsiness).
>
> I'd also need a clue on attribute expressions.  I can't get'em to work 
> either.
>
> XPath expression: "BBB[@id=\'b1\']"
>
> XML document:
>
> <?xml version="1.0"?>
> <AAA>
>   <BBB id = "b1"/>
>   <BBB name = " bbb "/>
>   <BBB name = "bbb"/>
> </AAA>
>
>
> Thanks in advance.  Regards,
>
> -- 
> Quique
> http://www.des.udc.es/~mpquique/
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2112 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040308/8ef454e7/attachment.bin>


More information about the erlang-questions mailing list