*/
class BIFE_Parser {
/**
- * Output string.
+ * Top level widget.
*
- * @var string $output
+ * @var BIFE_Widget $root
* @access public
*/
- var $output;
+ var $root;
/**
* XML parser resource.
/**
* Constructor.
*
- * @param HTML_Template_Sigma &$template Template to use to render the widgets.
- *
* @return void
* @access public
*/
- function BIFE_Parser(&$template) // ~X2C
+ function BIFE_Parser() // ~X2C
{
$this->__construct($template);
}
/**
* Constructor.
*
- * @param HTML_Template_Sigma &$template Template to use to render the widgets.
- *
* @return void
* @access public
*/
- function __construct(&$template) // ~X2C
+ function __construct() // ~X2C
{
$this->stack = array();
- $this->output = '';
+ $this->root = null;
$this->parser = xml_parser_create();
$this->template =& $template;
xml_set_object($this->parser, $this);
end($this->stack);
$parent =& $this->stack[key($this->stack)];
if ($parent) {
- $parent->addContents($current->render($this->template));
+ $parent->addContents($current);
} else {
- $this->output = $current->render($this->template);
+ $this->root =& $current;
}
}
// -X2C
// +X2C Operation 37
/**
- * Parse a XML file returning the rendered output.
+ * Parse a XML file with a complete and valid XML document.
*
* @param string $filename Filename to parse.
*
- * @return void
+ * @return &BIFE_Widget
* @access public
*/
- function parseFile($filename) // ~X2C
+ function &parseFile($filename) // ~X2C
{
if ($fp = @fopen($filename, "r")) {
while ($data = fread($fp, 4096)) {
E_USER_WARNING);
}
fclose($fp);
+ return $this->root;
}
// -X2C
- // +X2C Operation 38
+
+ // +X2C Operation 74
/**
- * Get rendered output.
+ * Parse a XML string with a complete and valid XML document.
+ *
+ * @param string $data XML data to parse.
*
- * @return string
+ * @return &BIFE_Widget
* @access public
*/
- function getOutput() // ~X2C
+ function &parseString($data) // ~X2C
{
- return $this->output;
+ $this->parse($data, true);
+ return $this->root;
}
// -X2C
} // -X2C Class :Parser
-?>
\ No newline at end of file
+?>