/** * 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); }
/** * 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); }
/** * 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; }