Should you ever need to work with XPath extensively, there's XPather for Firefox, that looks quite nice, but unfortunately I couldn't get it to work today, so I had to improvise. Then I stumpled across the very cool feature of xmllint, that lets you browse XML documents like directories.
(fa@don):(~/tmp) $ cat test.xml
<body>
<table><tr><td>a</td><td>b</td></tr></table>
<div>
<table><tr><td>c</td><td>d</td></tr></table>
</div>
</body>
(fa@don):(~/tmp) $ xmllint --shell test.xml
/ > cd //table[parent::div]/tr/td
td > ls
t-- 1 d
td >
And to not be completely offtopic, I'll admit that once I got my XPath expressions, I fed them to SimpleXML
(fa@don):(~/tmp) $ cat test.xml
<body>
<table><tr><td>a</td><td>b</td></tr></table>
<div>
<table><tr><td>c</td><td>d</td></tr></table>
</div>
</body>
(fa@don):(~/tmp) $ xmllint --shell test.xml
/ > cd //table[parent::div]/tr/td
td > ls
t-- 1 d
td >
And to not be completely offtopic, I'll admit that once I got my XPath expressions, I fed them to SimpleXML
Posted by fa
in IT, PHP
| Comments (0)
| Trackbacks (0)
Related entries by tags:
Code Coverage problems
PHP Unconference Hamburg 2009 - Nachlese
URL Shorteners
Blog-Software
Google App Engine
Code Coverage problems
PHP Unconference Hamburg 2009 - Nachlese
URL Shorteners
Blog-Software
Google App Engine
Trackbacks
Trackback specific URI for this entry
No Trackbacks
Layout by Ricky Wilson | Serendipity Template by Carl Galloway | Login
About
Life's a bitch, life's a whore. Nothing less, nothing more.
Read More
Der Autor...
... studiert Informatik. Und zwar an der LMU München. Das mittlerweile schon eine ganze Weile. Nebenher arbeitet er als PHP-Entwickler und Admin. Seit geraumer Zeit sogar regelmäßig und in Farbe
Quicksearch
last.fm
Song: Weather Experience (Top Buzz remix)
Artist: The Prodigy
14. June 2009, 19:23
Song: Charly (Trip Into Drum and Bass version)
Artist: The Prodigy
14. June 2009, 19:17
Song: Wind It Up (Rewound)
Artist: The Prodigy
14. June 2009, 19:11
10. March 2010, 23:33


