Example #1
0
 /**
  *@desc Get a XMLDocument from a XMLFile
  *@param XMLFilenameProcessor $xmlFile XML File
  *@return DOMDocument
  */
 public function getXmlDocument($xmlFile)
 {
     $this->_context->setXml($xmlFile->ToString());
     // Load XMLDocument and add ALL and INDEX nodes
     $xmlDoc = new DOMDocument();
     try {
         if (!($xmlFile->getFilenameLocation() == ForceFilenameLocation::PathFromRoot)) {
             $xmlDoc = $this->_context->getXMLDataBase()->getDocument($xmlFile->FullQualifiedName(), null);
         } else {
             $xmlDoc = XmlUtil::CreateXmlDocumentFromFile($xmlFile->FullQualifiedNameAndPath());
         }
     } catch (Exception $ex) {
         $xmlFileNotFound = new XMLFilenameProcessor("notfound");
         if ($this->_context->getXMLDataBase()->existsDocument($xmlFileNotFound->FullQualifiedName())) {
             $xmlDoc = $this->_context->getXMLDataBase()->getDocument($xmlFileNotFound->FullQualifiedName(), null);
         } else {
             throw $ex;
         }
     }
     $xmlRootNode = $xmlDoc->getElementsByTagName("page")->item(0);
     if ($xmlRootNode != null) {
         $this->addXMLDefault($xmlRootNode);
     }
     return $xmlDoc;
 }