示例#1
0
文件: Node.php 项目: kractos26/orfeo
 /**
  * Constructor
  *
  * @param  string    name            Node name
  * @param  string    content         Node content (text)
  * @param  array     attributes      Attribute-hash for the node
  */
 function XML_Tree_Node($name, $content = '', $attributes = array(), $lineno = null, $use_cdata_section = null)
 {
     $check_name = XML_Tree::isValidName($name, 'element');
     if (PEAR::isError($check_name)) {
         $this->error =& $check_name;
         return;
     }
     if (!is_array($attributes)) {
         $attributes = array();
     }
     foreach ($attributes as $attribute_name => $value) {
         $error = XML_Tree::isValidName($attribute_name, 'Attribute');
         if (PEAR::isError($error)) {
             $this->error =& $error;
             return;
         }
     }
     $this->name = $name;
     $this->setContent($content, $use_cdata_section);
     $this->attributes = $attributes;
     $this->children = array();
     $this->lineno = $lineno;
 }