Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

xpath saveHTML - how?

3:14 pm on Jul 19, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:May 11, 2008
votes: 0

I'm stuck. Is there a way to effectively xpath to an html table and then save all of that tables html? The following is what I mean but of course it doesn't work.

$doc = new DOMDocument();
$xpath = new DOMXPath($doc);
$x = $xpath->query("//div[@id='A-Div-Test']/table");
print $x->saveHTML();


11:54 pm on July 19, 2009 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 0

save - to where? another text file?

Assuming your HTML is also valid XML, if you get the right XPATH, you should be able to select it and convert it into a string.

perhaps DOMXPath::evaluate would do the trick?


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members