xml2struct cannot access element(s)

Posted by csetzkorn on Stack Overflow See other posts from Stack Overflow or by csetzkorn
Published on 2012-06-20T15:12:47Z Indexed on 2012/06/20 15:16 UTC
Read the original article Hit count: 240

Filed under:

I try to use this:

xml2struct

when I use this xml:

<XMLname attrib1="Some value">
    <Element>Some text</Element>
    <DifferentElement attrib2="2">Some more text</DifferentElement>
    <DifferentElement attrib3="2" attrib4="1">Even more text</DifferentElement>
</XMLname>

I can create a struct:

test = xml2struct('C:\bla\bla.xml');

(tested it with class(test))

It looks like this:

test =

      Name: 'XMLname'
Attributes: [1x1 struct]
      Data: ''
  Children: [1x7 struct]

But I cannot access:

test.XMLname.Element.Text

I get:

??? Reference to non-existent field 'XMLname'.

Any ideas?

© Stack Overflow or respective owner

Related posts about matlab