예제 #1
0
 public function testRender2()
 {
     $node = Tree::mult(Tree::add('x', 67), Tree::pow(Tree::mult('x', Tree::mult(4, 'x'), Tree::add(Tree::mult('x', 67), Tree::pow(Tree::mult('x', 24), 2))), 2));
     $xml = XMLVisitor::init();
     $str = $xml->visit($node);
     echo $str;
     $xml = new \DOMDocument();
     $xml->loadXML($str);
     $this->assertTrue($xml->schemaValidate(__DIR__ . '/../../../resources/tree-schema.xsd'));
 }
예제 #2
0
파일: XMLVisitor.php 프로젝트: sysvyz/anan
 public function visitPowerNode(PowerNode $node)
 {
     $v = new XMLVisitor($this->depth + 3);
     return $this->_renderNode($this->_indent($this->depth + 1) . '<power>' . PHP_EOL . $this->_indent($this->depth + 2) . '<base>' . PHP_EOL . $v->visit($node->getBase()) . PHP_EOL . $this->_indent($this->depth + 2) . '</base>' . PHP_EOL . $this->_indent($this->depth + 2) . '<exponent>' . PHP_EOL . $v->visit($node->getExponent()) . PHP_EOL . $this->_indent($this->depth + 2) . '</exponent>' . PHP_EOL . $this->_indent($this->depth + 1) . '</power>');
 }