Adding your new cd to the existing DOMIT_Document requires that you create and populate a new DOMIT_Element named "cd". You do this using the createElement method of DOMIT_Document.
$newCDNode =& $cdCollection->createElement("cd");
This creates a node that, if printed out using the toString method, would look like this:
<cd></cd>
We need to add an "id" attribute, however, so that the node is consistent with the existing "cd" nodes. We can do this using the setAttribute method:
$newCDNode->setAttribute("id", "4");
|