1

This should be rather a simple task, but for some reasons a part of my xml file hasn't been read properly...

This is the XML Section in question:

<MTX> ... <MoClass code=".0" modi="XYZ"> ..... </MoClass> ...... </MTX> 

Now, i want to fetch the Node by following code:

 $xml = simplexml_load_file(filename) //this fails due to invalid predicate... $xml->xPath('//MoClass[@code=".0" AND @modi="XYZ"]'); //but when i reverse the sequence of attributes $xml->xPath('//MoClass[@modi="XYZ" AND @code=".0"]'); //then it works as expected and the node may be processed further... 

What is the difference? Thanks in advance

1 Answer 1

1

Xpath is case-sensitive. Use and instead of 'AND'

demo

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

1 Comment

Glad t help. Good luck!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.