Lines Matching refs:doc
50 doc = create_doc_without_doctype(doctype)
51 doctype.entities.item(0).ownerDocument = doc
52 doctype.notations.item(0).ownerDocument = doc
53 return doc
365 def get_empty_nodelist_from_elements_by_tagName_ns_helper(self, doc, nsuri, argument
367 nodelist = doc.getElementsByTagNameNS(nsuri, lname)
371 doc = parseString('<doc/>')
373 doc, 'http://xml.python.org/namespaces/a', 'localname')
375 doc, '*', 'splat')
377 doc, 'http://xml.python.org/namespaces/a', '*')
379 doc = parseString('<doc xmlns="http://xml.python.org/splat"><e/></doc>')
381 doc, "http://xml.python.org/splat", "not-there")
383 doc, "*", "not-there")
385 doc, "http://somewhere.else.net/not-there", "e")
484 doc = parseString("<doc/>")
485 elem = doc.createElement("extra")
487 self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
489 doc.unlink()
492 doc = parseString("<doc a=''/>")
493 e = doc.documentElement
501 doc = parseString("<doc xmlns:a='http://xml.python.org/' a:b=''/>")
502 e = doc.documentElement
561 doc = parseString("<?xml version='1.0'?>\n"
567 doc2 = doc.cloneNode(0)
573 doc = parseString("<?xml version='1.0'?>\n"
579 doc2 = doc.cloneNode(1)
580 self.confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)),
582 self.confirm(len(doc.childNodes) == len(doc2.childNodes),
588 self.confirm(not doc.documentElement.isSameNode(doc2.documentElement),
590 if doc.doctype is not None:
595 self.confirm(not doc.doctype.isSameNode(doc2.doctype))
632 doc = create_doc_with_doctype()
633 clone = doc.doctype.cloneNode(1)
651 doc = create_doc_with_doctype()
652 clone = doc.doctype.cloneNode(0)
681 doc = parseString("<doc attr='value'/>")
682 attr = doc.documentElement.getAttributeNode("attr")
701 doc = parseString("<?target data?><doc/>")
702 pi = doc.firstChild
715 doc = parseString("<doc/>")
716 root = doc.documentElement
717 root.appendChild(doc.createTextNode("first"))
718 root.appendChild(doc.createTextNode("second"))
722 doc.normalize()
728 doc.unlink()
730 doc = parseString("<doc/>")
731 root = doc.documentElement
732 root.appendChild(doc.createTextNode(""))
733 doc.normalize()
737 doc.unlink()
740 doc = parseString("<doc/>")
741 root = doc.documentElement
742 root.appendChild(doc.createTextNode("first"))
743 root.appendChild(doc.createTextNode("second"))
744 root.appendChild(doc.createElement("i"))
748 doc.normalize()
758 doc.unlink()
761 doc = parseString("<doc/>")
762 root = doc.documentElement
763 root.appendChild(doc.createTextNode("first"))
764 root.appendChild(doc.createTextNode(""))
768 doc.normalize()
776 doc.unlink()
779 doc = parseString("<doc/>")
780 root = doc.documentElement
781 root.appendChild(doc.createTextNode(""))
782 root.appendChild(doc.createTextNode("second"))
786 doc.normalize()
794 doc.unlink()
797 doc = parseString("<doc/>")
798 root = doc.documentElement
799 root.appendChild(doc.createElement("i"))
800 root.appendChild(doc.createTextNode(""))
801 root.appendChild(doc.createElement("i"))
805 doc.normalize()
814 doc.unlink()
817 doc = parseString("<doc/>")
818 root = doc.documentElement
819 root.appendChild(doc.createTextNode(""))
820 root.appendChild(doc.createTextNode("second"))
821 root.appendChild(doc.createTextNode(""))
822 root.appendChild(doc.createTextNode("fourth"))
823 root.appendChild(doc.createTextNode(""))
827 doc.normalize()
835 doc.unlink()
838 doc = parseString("<doc>"
855 root = doc.documentElement
856 root.childNodes[0].appendChild(doc.createTextNode(""))
857 root.childNodes[0].appendChild(doc.createTextNode("x"))
858 root.childNodes[1].childNodes[0].appendChild(doc.createTextNode("x2"))
859 root.childNodes[1].appendChild(doc.createTextNode("x3"))
860 root.appendChild(doc.createTextNode(""))
870 doc.normalize()
897 doc.unlink()
901 doc = parseString("<o>text</o>")
902 text = doc.documentElement.childNodes[0]
906 doc.unlink()
909 doc = parseString("<o><i/>t</o>")
910 node = doc.documentElement
917 doc = parseString("<doc><?pi?>text?<elm/></doc>")
918 root = doc.documentElement
928 doc.unlink()
931 doc = parseString(
933 root = doc.documentElement
938 self.confirm(root.parentNode is doc and
943 doc.unlink()
946 doc = parseString("<doc><e/><e/></doc>")
947 children = doc.childNodes
955 doc.unlink()
971 doc = sax2dom.document
972 root = doc.documentElement
985 self.confirm(root.parentNode is doc and
990 doc.unlink()
993 doc = parseString('<foo>€</foo>')
994 self.confirm(doc.toxml() == u'<?xml version="1.0" ?><foo>\u20ac</foo>'
995 and doc.toxml('utf-8') ==
997 and doc.toxml('iso-8859-15') ==
1006 doc.unlink()
1039 def checkRenameNodeSharedConstraints(self, doc, node): argument
1041 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
1048 doc = parseString("<doc a='v'/>")
1049 elem = doc.documentElement
1054 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
1064 and attr.ownerDocument.isSameNode(doc)
1068 attr = doc.renameNode(attr, "http://xml.python.org/ns", "c")
1084 attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d")
1103 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
1119 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
1121 self.checkRenameNodeSharedConstraints(doc, attr)
1122 doc.unlink()
1125 doc = parseString("<doc/>")
1126 elem = doc.documentElement
1129 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
1135 and elem.ownerDocument.isSameNode(doc))
1138 elem = doc.renameNode(elem, "http://xml.python.org/ns", "b")
1144 and elem.ownerDocument.isSameNode(doc))
1147 elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c")
1153 and elem.ownerDocument.isSameNode(doc))
1156 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
1162 and elem.ownerDocument.isSameNode(doc))
1164 self.checkRenameNodeSharedConstraints(doc, elem)
1165 doc.unlink()
1170 doc = xml.dom.minidom.getDOMImplementation().createDocument(
1172 node = doc.createComment("comment")
1173 self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
1175 doc.unlink()
1178 doc = parseString("<doc>a</doc>")
1179 elem = doc.documentElement
1184 elem.appendChild(doc.createTextNode("b"))
1186 elem.insertBefore(doc.createCDATASection("c"), text)
1190 splitter = doc.createComment("comment")
1192 text2 = doc.createTextNode("d")
1197 x = doc.createElement("x")
1203 x = doc.createProcessingInstruction("y", "z")
1214 doc = parseString("<doc><e/></doc>")
1215 elem = doc.documentElement
1224 doc = parseString("<doc>a<e/>d</doc>")
1225 elem = doc.documentElement
1229 elem.insertBefore(doc.createTextNode("b"), splitter)
1230 elem.insertBefore(doc.createCDATASection("c"), text1)
1231 return doc, elem, text1, splitter, text2
1233 doc, elem, text1, splitter, text2 = setup()
1239 doc, elem, text1, splitter, text2 = setup()
1245 doc, elem, text1, splitter, text2 = setup()
1252 doc = parseString(
1269 elem = doc.documentElement
1285 doc = parseString("<doc a1='v' a2='w'/>")
1286 e = doc.documentElement
1289 self.confirm(doc.getElementById("v") is None
1293 self.confirm(e.isSameNode(doc.getElementById("v"))
1297 self.confirm(e.isSameNode(doc.getElementById("v"))
1298 and e.isSameNode(doc.getElementById("w"))
1302 a3 = doc.createAttribute("a1")
1305 self.confirm(doc.getElementById("v") is None
1306 and e.isSameNode(doc.getElementById("w"))
1311 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1312 self.confirm(e.isSameNode(doc.getElementById("w"))
1318 doc = parseString("<doc"
1322 e = doc.documentElement
1325 self.confirm(doc.getElementById("v") is None
1329 self.confirm(e.isSameNode(doc.getElementById("v"))
1333 self.confirm(e.isSameNode(doc.getElementById("v"))
1334 and e.isSameNode(doc.getElementById("w"))
1338 a3 = doc.createAttributeNS(NS1, "a1")
1341 self.confirm(e.isSameNode(doc.getElementById("w")))
1345 self.confirm(doc.getElementById("v") is None)
1347 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1348 self.confirm(e.isSameNode(doc.getElementById("w"))
1354 doc = parseString("<doc"
1358 e = doc.documentElement
1361 self.confirm(doc.getElementById("v") is None
1365 self.confirm(e.isSameNode(doc.getElementById("v"))
1369 self.confirm(e.isSameNode(doc.getElementById("v"))
1370 and e.isSameNode(doc.getElementById("w"))
1374 a3 = doc.createAttributeNS(NS1, "a1")
1377 self.confirm(e.isSameNode(doc.getElementById("w")))
1381 self.confirm(doc.getElementById("v") is None)
1383 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1384 self.confirm(e.isSameNode(doc.getElementById("w"))
1387 def assert_recursive_equal(self, doc, doc2): argument
1388 stack = [(doc, doc2)]
1419 self.assertTrue(n1.ownerDocument.isSameNode(doc))
1425 doc = parseString(sample)
1427 s = pickle.dumps(doc, proto)
1429 self.assert_recursive_equal(doc, doc2)
1432 doc = parseString(sample)
1433 doc2 = copy.deepcopy(doc)
1434 self.assert_recursive_equal(doc, doc2)
1437 doc = create_doc_without_doctype()
1438 doc.appendChild(doc.createComment("foo--bar"))
1439 self.assertRaises(ValueError, doc.toxml)
1442 doc = parseString("<element xmlns=''>\n"
1444 doc2 = parseString(doc.toxml())