0

I was using this to get the value under properties which work well when I have only one

$val = $child->findvalue('@value');

But now have several elements under properties, is there an easy way to get the value of property that is name=”BBB” ?

-<properties> 
       <property name="AAA" value="ABC"/> 
       <property name="BBB" value="DGT"/>
       <property name="CCC" value="DGT"/>
 </properties>
1
  • What module are you using? And, are you stuck with it or are you open to other options? Commented May 22, 2014 at 15:36

2 Answers 2

2

Using XPath.

$val = $child->findvalue('property[@name="BBB"]/@value');

For additional examples of XPaths, check out: XPath Examples

Sign up to request clarification or add additional context in comments.

Comments

0

findvalue takes an XPath as an argument. The XPath to fetch the desired value with the properties element as the context node is

property[@name="BBB"]/@value

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.