How would I go about adding text into an XML element? For example:
<videoTitle>I want to add text here</videoTitle>
I have created the DOMDocument, and begun adding the elements. Here is the element that I need to add the text to.
$title = $vitals->appendChild($X->createElement("title"));
You need to use
DOMDocument::createTextNodeAlternatively, you can use the shortcut syntax of
DOMNode::$nodeValue:You have to remember with this technique that
nodeValuesets the text content, not the XML content. Tags are escaped, not parsed.