コード例 #1
0
    def testIterNode(self):
        result = []
        expected = ["FOO", "BAR"]

        for nameElem in HelperXml.iterNodeElement( self.dom, "root", "blap", "subnode", "name" ):
            result.append(HelperXml.getNodeText(nameElem))

        self.assertEqual( result, expected )
コード例 #2
0
    def testIterNodeAttrManual(self):
        result = []
        expected = ["1", "2", "3"]

        for nodeElem in HelperXml.iterNodeElement( self.dom, "root", "node" ):
            result.append(HelperXml.getNodeAttribute(nodeElem, "attr"))

        self.assertEqual( result, expected )