[Scilab-users] xmlXPath query
Calixte Denizet
calixte.denizet at scilab-enterprises.com
Sun Mar 1 21:30:04 CET 2015
Hi Samuel,
On 01/03/2015 19:56, Samuel Gougeon wrote:
> Hello,
>
> Despite many trials, i am failing extracting the value of an attribute
> with xmlXPath().
> Here is an example:
>
> text = ["<main>"
> " <itag target=""valueA"" url=""valueB"" />"
> " <itag target=""valueA2"" url=""valueB2"" />"
> " <itag target=""valueA3"" url=""valueB3"" />"
> "</main>"
> ];
> doc = xmlReadStr(text)
>
> Now, we want to select all <itagentries for which the targetattribute
> has a given value (say valueA2), and for them, get the related urlvalue:
>
> -->e = xmlXPath(doc, "//itag[@target=""valueA2""]") // works:
> e =
> XML List
> size: 1
>
you got a list with one element
> but ehas no attributes fields. So i cannot get its url contents:
> -->e.name
> ans =
> itag
e(1).name
fyi e.name is a shortcut to get all the nodes name in the list.
>
> -->e.attributes
> !--error 999
> %XMLSet_e: Unknown field: attributes
>
e(1).attributes
> How is it possible to do what we expect, whether it is?
> Reading examples on the official xmlXPath webpage did not help...
>
> Thanks for any hints
> Samuel
>
Best regards
Calixte
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
--
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
http://www.scilab-enterprises.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150301/7a87a065/attachment.htm>
More information about the users
mailing list