comparison m-toolbox/classes/+utils/@xml/getChildByName.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1
2 function result = getChildByName(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.NODE);
16
17 end