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
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...
... studierte bisher Informatik. Und zwar an der LMU München. Nebenher arbeitete er als PHP-Entwickler und Admin. Seit kurzem sogar Vollzeit und in Farbe
Quicksearch
last.fm
Song: World On Fire
Artist: Sarah McLachlan
1. February 2012, 13:30
Song: Grafton Street
Artist: Dido
1. February 2012, 13:24
Song: Warrior's Dance (Benga Remix)
Artist: The Prodigy
16. October 2011, 17:18
17. May 2012, 22:07


