G
G
giggigi2010-12-11 21:50:53
XPath
giggigi, 2010-12-11 21:50:53

xpath getting attribute

There is an xml like

TITLE
<test:test1>TEST</test:test1>
<test:test2 at:attr="attribute">TEST2</test:test2>

How to get TITLE, TEST and TEST2 is not a question.
TITLE is obtained simply, TEST and TEST2 via
$xml->xpath('//test:test1');

but how to get at:attr and "attribute" via xpath? Or at least an attribute? As I understand it, you need to get it through @ but it doesn’t work like this //test:[email protected]:attr

Please tell me who is familiar with xpath

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
one_note_only, 2010-12-11
@gigigi

//test:test2/@at:attr

K
keatis, 2010-12-12
@keatis

but this doesn't work //test:[email protected]:attr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question