From: Danyang on
Hey,
I'm trying to parse the following xml data:
<root>
<child>2</child>
</root>
into a structure, but instead of 2, it gives me [#text: 2]. (I use char(...item(0) to get the str. Is there a way for matlab to read only the number?

Also, the actual XML i'm doing is quite large, and the example in doc is not quite handy.Basically the node name is the field name and text corresponds to value. Is there any other function that I can use to parse XML into Struct?

Thanks.

Danyang
From: Amanda Galtman on

"Danyang " <fnosdy(a)umich.edu> wrote in message
news:hup0td$qse$1(a)fred.mathworks.com...
> Hey,
> I'm trying to parse the following xml data:
> <root>
> <child>2</child>
> </root>
> into a structure, but instead of 2, it gives me [#text: 2]. (I use
> char(...item(0) to get the str. Is there a way for matlab to read only the
> number?
> Also, the actual XML i'm doing is quite large, and the example in doc is not
> quite handy.Basically the node name is the field name and text corresponds to
> value. Is there any other function that I can use to parse XML into Struct?
>
> Thanks.
>
> Danyang
>

Hi Danyang,

Does the following thread help?
http://www.mathworks.in/matlabcentral/newsreader/view_thread/278058#731576

Amanda


From: Danyang on
Thanks! Actually I went to w3school.com and learn how to use DOM parser to figure it out. I have some suggestion: the doc in mathwork didn't really tell how to extract data from DOM. it would be best if people know what methods are in the object.

Danyang