homepage Welcome to WebmasterWorld Guest from 54.235.36.164
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
xpath saveHTML - how?
phred




msg:3955299
 3:14 pm on Jul 19, 2009 (gmt 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();
@$doc->loadHTMLFile("Test.txt");
$xpath = new DOMXPath($doc);
$x = $xpath->query("//div[@id='A-Div-Test']/table");
print $x->saveHTML();

Thanks,
Fred

 

httpwebwitch




msg:3955475
 11:54 pm on Jul 19, 2009 (gmt 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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved