I\'m trying to parse a document and get all the image tags and change the source for something different.
$domDocument = new DOMDocument();
$domDo
If you're going to save as HTML, you have to expect a valid HTML document to be created!
There is another option: DOMDocument::saveXML has an optional parameter allowing you to access the XML content of a particular element:
$el = $domDocument->getElementsByTagName('p')->item(0);
$text = $domDocument->saveXML($el);
This presumes that your content only has one p element.