[Scilab-users] Getting names of attributes of an XML tag
Samuel Gougeon
sgougeon at free.fr
Tue Jun 9 13:13:43 CEST 2015
Le 31/05/2015 23:39, Samuel Gougeon a écrit :
> 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?
>
Yes! I finally got them:
> 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:
> *a= xmlXPath**(**doc.root.children(1)**,** **"@*"**)*
and finally:
>
> -->*a.name*
> ans =
>
> !att rib !
>
as well as
>
> -->*a.content*
> ans =
>
> !foo bar !
.
I would have expected that .name and .content be usable on e, but
previous trials showed that it is/was not the case
.
> -->e = doc.root.children(1).attributes
> e =
>
> XML Attributes
> att --> foo
> rib --> bar
>
> -->e.name
> ans =
> []
>
> -->e.content
> ans =
> []
It would be quite intuitive and more straightforward.
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150609/03cb4524/attachment.htm>
More information about the users
mailing list