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. Since DOMIT! attributes are regular PHP associative arrays, we can simply do this:
$newCDNode->attributes["id"] = 4;
|