本文整理汇总了PHP中XmlManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP XmlManager::getInstance方法的具体用法?PHP XmlManager::getInstance怎么用?PHP XmlManager::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlManager
的用法示例。
在下文中一共展示了XmlManager::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemoveNamespace
/**
* testRemoveNamespace method
*
* @access public
* @return void
*/
function testRemoveNamespace()
{
$this->Rss->addNs('custom', 'http://example.com/dtd.xml');
$this->Rss->addNs('custom2', 'http://example.com/dtd2.xml');
$manager =& XmlManager::getInstance();
$expected = array('custom' => 'http://example.com/dtd.xml', 'custom2' => 'http://example.com/dtd2.xml');
$this->assertEqual($manager->namespaces, $expected);
$this->Rss->removeNs('custom');
$expected = array('custom2' => 'http://example.com/dtd2.xml');
$this->assertEqual($manager->namespaces, $expected);
}
示例2: testNamespaces
/**
* testNamespaces method
*
* @access public
* @return void
*/
function testNamespaces()
{
$source = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
$xml = new Xml($source);
$expects = '<a:container xmlns:a="http://example.com/a" xmlns:b="http://example.com/b" xmlns:c="http://example.com/c" xmlns:d="http://example.com/d" xmlns:e="http://example.com/e" xmlns:f="http://example.com/f"><b:rule test=""><c:result>value</c:result></b:rule><d:rule test=""><e:result>value</e:result></d:rule></a:container>';
$_xml = XmlManager::getInstance();
$xml->addNamespace('f', 'http://example.com/f');
$result = $xml->toString(array('cdata' => false));
$this->assertEqual($expects, $result);
}
示例3: options
/**
* Sets/gets global XML options
*
* @param array $options
* @return array
* @access public
* @static
*/
function options($options = array())
{
$_this =& XmlManager::getInstance();
$_this->options = array_merge($_this->options, $options);
return $_this->options;
}