I have made this function:
protected function _addElement($xmlDocument, $elementName, $parentElement){
$element = $xmlDocument->createElement($elementName);
return $parentElement->appendChild($element);
}
and I call it, i.e., in this way:
$Street = $this->_addElement($xmlDocument, 'Steet', $xmlDocument);
$House = $this->_addElement($xmlDocument, 'House', $Street);
and in the created XML document I will have it looking like that:
<Street>
<House //maybe some attributes />
</Street>
So, the createElement($elementName)
function is from the DOM API, that I call upon the DOM object $xmlDocument
and it will create a closed node. What I need is to use a function that, with which I will get to the following result:
<Street>
<Yard> the dog pooped all over the backyard </Yard>
</Steet>
I looked in the DOM API for something involving text, etc. I stumbled upon createTextNode($content)
but that is something kinda' different, or maybe I just didn't understand correctly, when I read the documentiation.