Mercurial > hg > ltpda
annotate m-toolbox/classes/+utils/@xml/getChildrenByName.m @ 43:bc767aaa99a8
CVS Update
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 11:09:25 +0100 |
parents | f0afece42f48 |
children |
rev | line source |
---|---|
0 | 1 |
2 function result = getChildrenByName(node, childName) | |
3 | |
4 persistent FACTORY | |
5 persistent XPATH | |
6 | |
7 if isempty(FACTORY) | |
8 FACTORY = javax.xml.xpath.XPathFactory.newInstance(); | |
9 end | |
10 if isempty(XPATH) | |
11 XPATH = FACTORY.newXPath(); | |
12 end | |
13 | |
14 expression = XPATH.compile(sprintf('child::%s', childName)); | |
15 result = expression.evaluate(node, javax.xml.xpath.XPathConstants.NODESET); | |
16 | |
17 end |