コード例 #1
0
ファイル: Reader.php プロジェクト: bluesnowman/Chimera
 /**
  * This method parses an "idref" node.
  *
  * @access protected
  * @param \SimpleXMLElement $root                           a reference to the root node
  * @param \SimpleXMLElement $node                           a reference to the "idref" node
  * @return string                                           the id reference
  * @throws Throwable\Parse\Exception                        indicates that problem occurred while
  *                                                          parsing
  */
 protected function parseIdRefElement(\SimpleXMLElement $root, \SimpleXMLElement $node)
 {
     $attributes = $node->attributes();
     if (isset($attributes['local'])) {
         $idref = Spring\Data\XML::valueOf($attributes['local']);
         if (!Spring\Data\XML\Syntax::isIdref($idref, $root)) {
             throw new Throwable\Parse\Exception('Unable to process Spring XML. Expected a valid "idref" token, but got ":token".', array(':token' => $idref));
         }
         return $idref;
     } else {
         if (isset($attributes['object'])) {
             $idref = Spring\Data\XML::valueOf($attributes['object']);
             return $idref;
         } else {
             throw new Throwable\Parse\Exception('Unable to process Spring XML. Tag ":tag" is missing ":attribute" attribute', array(':tag' => 'idref', ':attribute' => 'object'));
         }
     }
 }