Absolute locations and attributes in xmerl_xpath.

Enrique Marcote Peña mpquique@REDACTED
Mon Mar 8 21:57:39 CET 2004


Thanks a lot Rudolph,

You don't have any tip on the use of attributes, do you? :-)

Best regards,

	Quique

On Monday 08 March 2004 19:12, Rudolph van Graan wrote:
> 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/

-- 
Quique
http://www.des.udc.es/~mpquique/




More information about the erlang-questions mailing list