source: trunk/src/@xmltree/children.m @ 1114

Last change on this file since 1114 was 925, checked in by sommeria, 9 years ago

xmltree updated

File size: 926 bytes
Line 
1function 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
19child = [];
20uid = uid(:);
21l = length(tree);
22for 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
30end
31if isempty(child), child = []; end
Note: See TracBrowser for help on using the repository browser.