[Scilab-users] xmlXPath query

Samuel Gougeon sgougeon at free.fr
Sun Mar 1 19:56:58 CET 2015


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

but ehas no attributes fields. So i cannot get its url contents:
-->e.name
  ans  =
  itag

-->e.attributes
     !--error 999
%XMLSet_e: Unknown field: 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150301/e5e40f7a/attachment.htm>


More information about the users mailing list