def testGetChildText(self): self.assertEqual(xmliks.getChildText(self.parsediks, "b"), xmlmdom.getChildText(self.parsedmdom, "b")) self.assertEqual(xmliks.getChildText(self.parsediks, "d"), xmlmdom.getChildText(self.parsedmdom, "d")) self.assertEqual(xmliks.getChildText(xmliks.getNode(self.parsediks, "b"), "c"), xmlmdom.getChildText(xmlmdom.getNode(self.parsedmdom, "b"), "c"))
def testAddText(self): xmliks.addText( self.parsediks, "newtag", "Something else in newtag under a") xmliks.addText( xmliks.getNode( self.parsediks, "b"), "newtag", "Something else in newtag under b") xmlmdom.addText( self.parsedmdom, "newtag", "Something else in newtag under a") xmlmdom.addText( xmlmdom.getNode( self.parsedmdom, "b"), "newtag", "Something else in newtag under b") self.assertEqual( xmliks.toString( self.parsediks), xmlmdom.toString( self.parsedmdom))
def testGetNode(self): self.assertEqual( xmliks.getNode( xmliks.getNode( self.parsediks, "b"), "c").toString(), '<c>something in c tag.</c>') self.assertEqual( xmlmdom.getNode( xmlmdom.getNode( self.parsedmdom, "b"), "c").toxml(), '<c>something in c tag.</c>') self.assertEqual(xmliks.getNode(xmliks.getNode(self.parsediks, "b"), "c").toString(), xmlmdom.getNode(xmlmdom.getNode(self.parsedmdom, "b"), "c").toxml())
def testAddNode(self): xmliks.addNode(self.parsediks, "newtag") xmliks.addNode(xmliks.getNode(self.parsediks, "b"), "newtag") xmlmdom.addNode(self.parsedmdom, "newtag") xmlmdom.addNode(xmlmdom.getNode(self.parsedmdom, "b"), "newtag") self.assertEqual( xmliks.toString( self.parsediks), xmlmdom.toString( self.parsedmdom))
def testRemoveChildText(self): xmliks.removeChildText(xmliks.getNode(self.parsediks, "d")) xmlmdom.removeChildText(xmlmdom.getNode(self.parsedmdom, "d")) self.assertEqual( xmliks.toString( self.parsediks), '<a><b atrib="something">something in b tag.<c>something in c tag.</c></b><d/></a>') self.assertEqual( xmlmdom.toString( self.parsedmdom), '<a><b atrib="something">something in b tag.<c>something in c tag.</c></b><d></d></a>')
def testRemoveChild(self): xmliks.removeChild(xmliks.getNode(self.parsediks, "d"), self.parsediks) xmlmdom.removeChild( xmlmdom.getNode( self.parsedmdom, "d"), self.parsedmdom) self.assertEqual( xmliks.toString( self.parsediks), xmlmdom.toString( self.parsedmdom))
def testSetNodeAttribute(self): xmliks.setNodeAttribute( xmliks.getNode( self.parsediks, "b"), "atrib", "everything") xmlmdom.setNodeAttribute( xmlmdom.getNode( self.parsedmdom, "b"), "atrib", "everything") self.assertEqual( xmliks.getNodeAttribute( xmliks.getNode( self.parsediks, "b"), "atrib"), "everything") self.assertEqual( xmlmdom.getNodeAttribute( xmlmdom.getNode( self.parsedmdom, "b"), "atrib"), "everything") self.assertEqual(xmliks.getNodeAttribute(xmliks.getNode(self.parsediks, "b"), "atrib"), xmlmdom.getNodeAttribute(xmlmdom.getNode(self.parsedmdom, "b"), "atrib")) xmliks.setNodeAttribute( xmliks.getNode( self.parsediks, "d"), "atrib", "anything") xmlmdom.setNodeAttribute( xmlmdom.getNode( self.parsedmdom, "d"), "atrib", "anything") self.assertEqual( xmliks.getNodeAttribute( xmliks.getNode( self.parsediks, "d"), "atrib"), "anything") self.assertEqual( xmlmdom.getNodeAttribute( xmlmdom.getNode( self.parsedmdom, "d"), "atrib"), "anything") self.assertEqual(xmliks.getNodeAttribute(xmliks.getNode(self.parsediks, "d"), "atrib"), xmlmdom.getNodeAttribute(xmlmdom.getNode(self.parsedmdom, "d"), "atrib"))
def testGetNodeAttribute(self): self.assertEqual( xmliks.getNodeAttribute( xmliks.getNode( self.parsediks, "b"), "atrib"), "something") self.assertEqual( xmlmdom.getNodeAttribute( xmlmdom.getNode( self.parsedmdom, "b"), "atrib"), "something") self.assertEqual(xmliks.getNodeAttribute(xmliks.getNode(self.parsediks, "b"), "atrib"), xmlmdom.getNodeAttribute(xmlmdom.getNode(self.parsedmdom, "b"), "atrib")) self.assertEqual( xmliks.getNodeAttribute( xmliks.getNode( self.parsediks, "b"), "actrib"), None) self.assertEqual( xmlmdom.getNodeAttribute( xmlmdom.getNode( self.parsedmdom, "b"), "actrib"), None) self.assertEqual(xmliks.getNodeAttribute(xmliks.getNode(self.parsediks, "b"), "actrib"), xmlmdom.getNodeAttribute(xmlmdom.getNode(self.parsedmdom, "b"), "actrib")) self.assertEqual( xmliks.getNodeAttribute( xmliks.getNode( self.parsediks, "d"), "atrib"), None) self.assertEqual( xmlmdom.getNodeAttribute( xmlmdom.getNode( self.parsedmdom, "d"), "atrib"), None) self.assertEqual(xmliks.getNodeAttribute(xmliks.getNode(self.parsediks, "d"), "atrib"), xmlmdom.getNodeAttribute(xmlmdom.getNode(self.parsedmdom, "d"), "atrib"))