本文整理汇总了PHP中Tree::root方法的典型用法代码示例。如果您正苦于以下问题:PHP Tree::root方法的具体用法?PHP Tree::root怎么用?PHP Tree::root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::root方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rootMember
public function rootMember()
{
with($t = new Tree('formresult'), $r = $t->root());
$this->assertClass($r, 'xml.Node');
$this->assertFalse($r->hasChildren());
$this->assertEmpty($r->getAttributes());
$this->assertEquals('formresult', $r->getName());
}
示例2: personTree
/**
* Returns an XML tree for use in further test cases
*
* @return xml.Tree
*/
protected function personTree()
{
$t = new Tree('person');
$t->root()->setAttribute('id', '1549');
$t->addChild(new Node('firstName', 'Timm'));
$t->addChild(new Node('lastName', 'Friebe'));
$t->addChild(new Node('location', 'Karlsruhe'));
$t->addChild(new Node('location', 'Germany'));
return $t;
}
示例3: marshal
/**
* Marshal an object to xml
*
* @param lang.Object instance
* @param xml.QName qname default NULL
* @return string xml
* @deprecated Use marshalTo() instead
*/
public static function marshal($instance, $qname = NULL)
{
$class = $instance->getClass();
// Create XML tree and root node. Use the information provided by the
// qname argument if existant, use the class` non-qualified (and
// lowercased) name otherwise.
$tree = new Tree();
if ($qname) {
$prefix = $qname->prefix ? $qname->prefix : $qname->localpart[0];
$tree->root()->setName($prefix . ':' . $qname->localpart);
$tree->root()->setAttribute('xmlns:' . $prefix, $qname->namespace);
} else {
if ($class->hasAnnotation('xmlns')) {
$tree->root()->setName($class->getSimpleName());
} else {
$tree->root()->setName(strtolower($class->getSimpleName()));
}
}
self::recurse($instance, $class, $tree->root(), array());
return $tree->getSource(INDENT_DEFAULT);
}
示例4: setXSLTree
public function setXSLTree()
{
$t = new Tree('xsl:stylesheet');
$t->root()->setAttribute('xmlns:xsl', 'http://www.w3.org/1999/XSL/Transform');
$this->processor->setXSLTree($t);
}