Does anyone use xmltree functions?

조회 수: 2 (최근 30일)
Chiara
Chiara 2013년 5월 21일
Hello, I am trying to read and translate a substation description from xml file to a matlab file. I have installed a XML parser (<http://www.artefact.tk/software/matlab/xml/>) and my code is almost done, but when I use the function find, it doesn't result index array that I expect.
I show an example of what happens:
example.xml
<?xml version="1.0" ?>
-
- <!-- This is the first entry of our Address Book -->
- <entry lastModified="16-May-2013">
<firstName test="testing" test3="testing3">John</firstName>
<lastName test2="testing2">Doh</lastName>
- <address>
<institute />
<street>1, Avenue des Champs Elysees</street>
<zipCode>75000</zipCode>
<city>Paris</city>
<country>France</country>
</address>
<phone>(+33) 1 23 45 67 89</phone>
<email>john.doh@email.com</email>
</entry>
- <entry lastModified="16-May-2013">
<firstName test="testing" test3="testing3">John</firstName>
<lastName test2="testing2">Doh</lastName>
- <address>
<institute />
<street>1, Avenue des Champs Elysees</street>
<zipCode>75000</zipCode>
<city>Paris</city>
<country>France</country>
</address>
<phone>(+33) 1 23 45 67 89</phone>
<email>john.doh@email.com</email>
</entry>
Ok now I create the tree: tree=xmltree('example.xml')
If I want to know where 'entry' is:
i=find(t,/addressBook/entry') i=[3 22]
Now if I suppose that index is referred to the next line, index 3 is for the fourth line, and there is Entry; index 22 should be for the 23th line then, but there's not entry!
How can I get the right index of each tag that I look for?
thank you

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by