[Scilab-users] Getting names of attributes of an XML tag

Samuel Gougeon sgougeon at free.fr
Sun May 31 23:39:52 CEST 2015


Hello,

I am trying to get the list of _names_ of attributes of an XML tag. 
Getting their values is OK, but i fail catching related names!
Is this possible?

 From XML examples:

s  =  "<root xmlns:bar=""http://www.scilab.org/"">"+..
     "<bar:a att=""foo"" rib=""bar"">"+..
     "<b>Hello</b><c> world</c></bar:a></root>"
doc  =  xmlReadStr  <xmlReadStr.html>(s);

Then:
-->e = doc.root.children(1).attributes
  e  =
XML Attributes
att --> foo
rib --> bar

Getting values is OK:
-->e(1)
  ans  =
  foo

but i need first to get names "att" and "rib" in a variable. I tried:
-->fieldnames(e)
  ans  =
  _id
??? nothing else.

I also tried through xmlXPath():

xmlXPath(doc.root.children(1),  "@*")
but it still return the same XML List.

Any clue would be welcome.
Thanks
Samuel

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


More information about the users mailing list