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

Samuel Gougeon sgougeon at free.fr
Tue Jun 9 13:32:08 CEST 2015


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>

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.

Samuel

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


More information about the users mailing list