Hi guys, im pretty new to the PHP DomDocument, im reading the documentation right now and im wondering is does exixts some selectors like the ones we seen in jquery.
Well, i exmplain my situation: i have this xml file to parse every day and update a database:
That's a little snapshot:
<gesmes:Envelope>
<gesmes:subject>Reference rates</gesmes:subject>
<gesmes:Sender>
<gesmes:name>European Central Bank</gesmes:name>
</gesmes:Sender>
<Cube>
<Cube time="2009-07-13">
<Cube currency="USD" rate="1.3975"/>
<Cube currency="JPY" rate="129.03"/>
<Cube currency="BGN" rate="1.9558"/>
<Cube currency="CZK" rate="26.028"/>
</Cube>
</Cube>
</gesmes:Envelope>
so, accessing this structure with jquery-like selectors will be dead simple:
$("Cube[currency]")
and i'll retrieve all the elements 'cube' with the 'currency' attribute.
But how to do that with PHP Domdocument? How to search the elements by attribute and/or attribute value?
I only saw the getElementsByTagName and getElementsById methods.
p.s: i gave a look to xpath too, but dont seem to work with DomDocument