Beispiel #1
0
 /**
  * Initialize the parser by loading a file or an XML string
  *
  * @param string $strXML Name of the XML file or XML string
  * @param Xml|Bean $xmlMom Parent node
  * @param  bool $bolLoadFile Load from file or parse locally
  * @return Xml|Bean
  */
 public static function returnNode($strXML, $xmlMom, $bolLoadFile)
 {
     try {
         if ($bolLoadFile) {
             $strXML = file_get_contents($strXML);
         }
     } catch (Exception $e) {
         throw new Exception("Could not read file: " . $strXML);
     }
     if ($xmlResult = $xmlMom->parse($strXML)) {
         return $xmlResult;
     }
     throw new Exception('Could not create XML node due to an parsing error.');
 }