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

Calixte Denizet calixte.denizet at scilab-enterprises.com
Tue Jun 9 14:00:18 CEST 2015


On 09/06/2015 13:32, Samuel Gougeon wrote:
> Le 09/06/2015 13:13, Samuel Gougeon a écrit :
>> .../...
>> 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.
> .
> OK, i have just caught why this is not implemented as this:
> e being an XML attribute object, e.mystring  points to the value of 
> the attribute named myString. So, e.name and e.content point to the 
> value of attributes named "name" and "content", as in <myTag 
> name="test" content="value">bla bla</myTag>
>

You're right !

> I don't know well XML conventions for attributes names. I am pretty 
> sure that attributes names should exclude some special chars like "&" 
> or some others. So, addressing the names could be done through e.name& 
> and values through  e.value& ... without having to use xmlXPath(). A 
> proposal.

Bof...

Maybe xmlName is what you expect: 
http://help.scilab.org/docs/5.5.2/en_US/xmlName.html

Calixte

>
> Samuel
>
>
>
> _______________________________________________
> 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/20150609/03e03614/attachment.htm>


More information about the users mailing list