Mercurial > hg > ltpda
annotate m-toolbox/classes/+utils/@xml/getChildrenByName.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
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 |