Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Win User
October 23, 2012, 12:17 pm
rate this thread
I am using DOMDocument class to build XML.
I obtained the DOMDocument by instantiating an implementation class with DTD,
then got the DOMDocument object from it.
But in using DOMDocument::saveXML() method to get string output, I am
disappointed in that output, and there seems to be no option (no configurable
property or method setting on DOMDocument class) to get what I want.
1. the 'encoding' and 'standalone' attributes in the output, inasmuch as I
specified them and validated the DTD against this already
2. I want the DOCTYPE specified in the output with the DTD I gave, inasmuch
as I specified it.
Before I try using XMLWriter class (and I am not sure it works), I am
wondering if there is an easy way out of this. If I have to use XMLWriter,
what is best approach of running either the DOMDocument or the string output
If XMLWriter object is what I need, the PHP documentation on XMLWriter class
"simple usage" or "quick guide" is non-existent (although methods features
are documented), and a Google search shows specific uses by others unrelated
to my particular problem.
ver PHP 5.4.8