Last change
on this file since 743 was
723,
checked in by sommeria, 11 years ago
|
xmltree and toolbox_calib added to svn
|
File size:
1.1 KB
|
Line | |
---|
1 | function uid = root(tree) |
---|
2 | % XMLTREE/ROOT Root Method |
---|
3 | % FORMAT uid = root(tree) |
---|
4 | % |
---|
5 | % tree - XMLTree object |
---|
6 | % uid - UID of the root element of tree |
---|
7 | %_______________________________________________________________________ |
---|
8 | % |
---|
9 | % Return the uid of the root element of the tree. |
---|
10 | %_______________________________________________________________________ |
---|
11 | % @(#)root.m Guillaume Flandin 02/04/17 |
---|
12 | |
---|
13 | % Actually root is necessarily the element whos UID is 1, by |
---|
14 | % construction. However, xml_parser should return a tree with a ROOT |
---|
15 | % element with as many children as needed but only ONE *element* child |
---|
16 | % who would be the real root (and this method should return the UID of |
---|
17 | % this element). |
---|
18 | |
---|
19 | uid = 1; |
---|
20 | |
---|
21 | % Update: |
---|
22 | % xml_parser has been modified (not as explained above) to handle the |
---|
23 | % case when several nodes are at the top level of the XML. |
---|
24 | % Example: <!-- beginning --><root>blah blah</root><!-- end --> |
---|
25 | % Now root is the first element node of the tree. |
---|
26 | |
---|
27 | % Look for the first element in the XML Tree |
---|
28 | for i=1:length(tree) |
---|
29 | if strcmp(get(tree,i,'type'),'element') |
---|
30 | uid = i; |
---|
31 | break |
---|
32 | end |
---|
33 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.