Php DomDocument question?

chronoel

New member
hi, after i got a node of the dom i want to output it as it was created for example as shown below:

$doc = new DOMDocument();
$doc->loadHTML("<tr><td id='foo' class='bar'>Baz</td></tr>");

$x = $doc->documentElement;
foreach ($x->childNodes AS $item) {
// output content of tr which is "<td id='foo' class='bar'>Baz</td>"
}

if i have the xml as <tr><td id='foo' class='bar'>Baz</td></tr>. i parsed it and my node is pointing to the tr element i want to output its content as "<td id='foo' class='bar'>Baz</td></tr>". how do i do that? i tried using saveHTML but it places the content within the "<html><body>...</body></html>" tags.
 
Back
Top