/**
  * Adds this resource page to the DOMDocument/XMLElement specified.
  * See toXml() for details.
  * $domtree : DOM document root
  * $parentElement : DOM element where this row will be added
  */
 function addSelfToDocument($domtree, $parentElement)
 {
     // create the root element for this class and append it to our parent
     $xmlRoot = $parentElement->appendChild($domtree->createElement('view'));
     $xmlRoot->appendChild($domtree->createElement('resources_url', home_url() . "/" . get_option('hbo_resources_url')));
     if ($this->isSaved) {
         $xmlRoot->appendChild($domtree->createElement('saved', 'true'));
     }
     $resource = ResourceDBO::fetchResourceById($this->resourceId);
     $xmlRoot->appendChild($domtree->createElement('resourceId', $this->resourceId));
     $xmlRoot->appendChild($domtree->createElement('resourceName', $resource->name));
     $propertiesElem = $xmlRoot->appendChild($domtree->createElement('properties'));
     foreach (ResourceDBO::getPropertiesForResource($this->resourceId) as $prop) {
         $propRow = $domtree->createElement('property');
         if ($prop->selected_yn == 'Y') {
             $attrSelected = $domtree->createAttribute('selected');
             $attrSelected->value = 'true';
             $propRow->appendChild($attrSelected);
         }
         $propRow->appendChild($domtree->createElement('id', $prop->property_id));
         $propRow->appendChild($domtree->createElement('value', $prop->description));
         $propertiesElem->appendChild($propRow);
     }
 }