Line | |
---|
1 | function child = children(tree,uid)
|
---|
2 | % XMLTREE/CHILDREN Return children's UIDs of node uid
|
---|
3 | % FORMAT child = children(tree,uid)
|
---|
4 | %
|
---|
5 | % tree - a tree
|
---|
6 | % uid - uid of the element
|
---|
7 | % child - array of the UIDs of children of node uid
|
---|
8 | %__________________________________________________________________________
|
---|
9 | %
|
---|
10 | % Return UID's of children of node uid
|
---|
11 | %__________________________________________________________________________
|
---|
12 | % Copyright (C) 2002-2011 http://www.artefact.tk/
|
---|
13 |
|
---|
14 | % Guillaume Flandin
|
---|
15 | % $Id: children.m 4460 2011-09-05 14:52:16Z guillaume $
|
---|
16 |
|
---|
17 | %error(nargchk(2,2,nargin));
|
---|
18 |
|
---|
19 | child = [];
|
---|
20 | uid = uid(:);
|
---|
21 | l = length(tree);
|
---|
22 | for i=1:length(uid)
|
---|
23 | if uid(i) > 0 && uid(i) <= l
|
---|
24 | if strcmp(tree.tree{uid(i)}.type,'element')
|
---|
25 | child = [child tree.tree{uid(i)}.contents];
|
---|
26 | end
|
---|
27 | else
|
---|
28 | error('[XMLTree] Invalid UID.');
|
---|
29 | end
|
---|
30 | end
|
---|
31 | if isempty(child), child = []; end
|
---|
Note: See
TracBrowser
for help on using the repository browser.