/**
  * Set PI Target
  *
  * @param str PI Target
  * @return bool
  * @access private
  */
 private function _setPITarget($sPITarget)
 {
     // Check target name
     if (preg_match('/^xml$/i', $sPITarget)) {
         throw new EasyXML_Exception('Processing instruction target cannot be xml, this is a reserved name');
         return false;
     }
     if (!EasyXML::validNodeName($sPITarget)) {
         throw new EasyXML_Exception('Invalid Processing instruction target "' . $mName . '"');
     }
     $this->_sPITarget = $sPITarget;
     return true;
 }
Example #2
0
 /**
  * Create a child processing instruction node
  *
  * @param str processing instruction target
  * @param str processing instruction value/content
  * @return new child node
  * @access public
  */
 public function createPI($sPITarget, $sValue = '')
 {
     // Check target name
     if (!EasyXML::validNodeName($sPITarget)) {
         throw new EasyXML_Exception('Invalid Processing instruction target "' . $sPITarget . '"');
     }
     $oChild = new EasyXML_ProcessingInstruction($this, $sPITarget, $sValue);
     $this->_aChildren[EasyXML::NODE_PI][] = $oChild;
     $this->_aChildOrder[] = $oChild;
     return $oChild;
 }