![]() |
XML help! How to get elements from an xml
Hey, I was wondering how you get certain elements from an xml file.
Say I had Code:
<title>Hello!</title> |
That's not an XML file (more precisely, it's invalid XML) but a good place to start would be to read the PHP manual pages on SimpleXML
|
I've started to get more into XPath recently, and it is a fantastic way to traverse the nodes! Something like so:
Code:
//span[@class='time']/parent::divspan elements where the class is precisely time -- if it's not precise you can use the contains function. Then its parent node of type div.It's such a beautiful way of doing things! |
I would go so far as to call it beautiful but XPath is very useful indeed.
P.S. Why on earth is that a reply to this topic? |
As this particular forum is dead! :-( And... and... XPath is useful for this kind of stuff.
|
| All times are GMT. The time now is 02:41 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0