I'm tryin to attach a dtd to xml held in a variable. I tried editing the example at php.net where someone has been able to used createElement to add the one element
When i tried it with loadXML it overwrites the dtd link
I have got a work around but just wondering if there is anything wrong with this.
PHP Code:
// Create an instance of the DomImplementation class
$impl = new DomImplementation;

// Create an instance of the DomDocumentType class by
// calling the DomImplementation::createDocumentType() method
// (arguments: doctype_name, doctype_public, doctype_system)
$dtd $impl->createDocumentType("read_list_data""""read_list_data.dtd");

// Create an instance of the DomDocument class by
// calling the DomImplementation::createDocument() method
// (arguments: NS_URL, NS_PREFIX, DomDocumentType_instance)
$dom $impl->createDocument(""""$dtd);

// Set other properties
$dom->encoding "UTF-8";
$dom->standalone "no";
$dom->loadXML($xmlstring]);
// Retrieve and print the document
print $dom->saveXML();