Пример #1
0
 /**
  * format an XML string
  *
  * @param string $string   XML
  * @param string $renderer the renderer type
  *
  * @return string formatted XML string
  * @access public
  * @throws PEAR_Error
  * @todo PEAR CS - should require_once be include_once?
  */
 function formatString($string, $renderer = "Plain")
 {
     /**
      * Split the document into tokens
      * using the XML_Tokenizer
      */
     require_once XML_BEAUTIFIER_INCLUDE_PATH . '/Tokenizer.php';
     $tokenizer = new XML_Beautifier_Tokenizer();
     $tokens = $tokenizer->tokenize($string, false);
     if (PEAR::isError($tokens)) {
         return $tokens;
     }
     $renderer = $this->_loadRenderer($renderer, $this->_options);
     if (PEAR::isError($renderer)) {
         return $renderer;
     }
     $xml = $renderer->serialize($tokens);
     return $xml;
 }
Пример #2
0
 /**
  * format an XML string
  *
  * @param string $string   XML
  * @param string $renderer the renderer type
  *
  * @return string formatted XML string
  * @access public
  * @throws PEAR_Error
  * @todo PEAR CS - should require_once be include_once?
  */
 function formatString($string, $renderer = "Plain")
 {
     /**
      * Split the document into tokens
      * using the XML_Tokenizer
      */
     $tokenizer = new \XML_Beautifier_Tokenizer();
     $tokens = $tokenizer->tokenize($string, false);
     if (PEAR::isError($tokens)) {
         return $tokens;
     }
     $renderer = $this->_loadRenderer($renderer, $this->_options);
     if (PEAR::isError($renderer)) {
         return $renderer;
     }
     $xml = $renderer->serialize($tokens);
     return $xml;
 }