I have XML that i need the user to be able to edit (inside a textarea) to his liking and then readd it to a DOMDocument Here is what i have so far.
$dom = new DOMDocument();
$dom->formatOutput = true; //Formating the output
$ele = $dom->createElement("someele", "Hello");
$dom->appendChild( $ele );
$string = "<yowhatsup><noway>some text</noway></yowhatsup>";
$ele = $dom->createElement("otherxmlstuff", $string);
$dom->appendChild( $ele );
Now the output encodes the $string variable and that is not good for me as i want the user to be able to add xml as well as a string into my DOMDocument.
Could I do some pre-processing to turn text into a element as well, or am I barking up the wrong tree.
You can use DOMDocumentFragment and its appendXML() method, e.g.
prints