Does anyone use xmltree functions?

2 views (last 30 days)
Chiara
Chiara on 21 May 2013
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

Answers (0)

Community Treasure Hunt

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

Start Hunting!