Lines Matching refs:doc

47     doc = create_doc_without_doctype(doctype)
48 doctype.entities.item(0).ownerDocument = doc
49 doctype.notations.item(0).ownerDocument = doc
50 return doc
61 doc = Document()
62 self.assertFalse(doc.async_)
428 def get_empty_nodelist_from_elements_by_tagName_ns_helper(self, doc, nsuri, argument
430 nodelist = doc.getElementsByTagNameNS(nsuri, lname)
434 doc = parseString('<doc/>')
436 doc, 'http://xml.python.org/namespaces/a', 'localname')
438 doc, '*', 'splat')
440 doc, 'http://xml.python.org/namespaces/a', '*')
442 doc = parseString('<doc xmlns="http://xml.python.org/splat"><e/></doc>')
444 doc, "http://xml.python.org/splat", "not-there")
446 doc, "*", "not-there")
448 doc, "http://somewhere.else.net/not-there", "e")
557 doc = parseString("<doc/>")
558 elem = doc.createElement("extra")
560 self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
562 doc.unlink()
585 doc = parseString("<doc a=''/>")
586 e = doc.documentElement
594 doc = parseString("<doc xmlns:a='http://xml.python.org/' a:b=''/>")
595 e = doc.documentElement
629 doc = dom.documentElement
630 self.assertTrue(doc.hasChildNodes())
686 doc = parseString("<?xml version='1.0'?>\n"
692 doc2 = doc.cloneNode(0)
698 doc = parseString("<?xml version='1.0'?>\n"
704 doc2 = doc.cloneNode(1)
705 self.confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)),
707 self.confirm(len(doc.childNodes) == len(doc2.childNodes),
713 self.confirm(not doc.documentElement.isSameNode(doc2.documentElement),
715 if doc.doctype is not None:
720 self.confirm(not doc.doctype.isSameNode(doc2.doctype))
757 doc = create_doc_with_doctype()
758 clone = doc.doctype.cloneNode(1)
776 doc = create_doc_with_doctype()
777 clone = doc.doctype.cloneNode(0)
806 doc = parseString("<doc attr='value'/>")
807 attr = doc.documentElement.getAttributeNode("attr")
826 doc = parseString("<?target data?><doc/>")
827 pi = doc.firstChild
891 doc = parseString("<doc/>")
892 root = doc.documentElement
893 root.appendChild(doc.createTextNode("first"))
894 root.appendChild(doc.createTextNode("second"))
898 doc.normalize()
904 doc.unlink()
906 doc = parseString("<doc/>")
907 root = doc.documentElement
908 root.appendChild(doc.createTextNode(""))
909 doc.normalize()
913 doc.unlink()
916 doc = parseString("<doc/>")
917 root = doc.documentElement
918 root.appendChild(doc.createTextNode("first"))
919 root.appendChild(doc.createTextNode("second"))
920 root.appendChild(doc.createElement("i"))
924 doc.normalize()
934 doc.unlink()
937 doc = parseString("<doc/>")
938 root = doc.documentElement
939 root.appendChild(doc.createTextNode("first"))
940 root.appendChild(doc.createTextNode(""))
944 doc.normalize()
952 doc.unlink()
955 doc = parseString("<doc/>")
956 root = doc.documentElement
957 root.appendChild(doc.createTextNode(""))
958 root.appendChild(doc.createTextNode("second"))
962 doc.normalize()
970 doc.unlink()
973 doc = parseString("<doc/>")
974 root = doc.documentElement
975 root.appendChild(doc.createElement("i"))
976 root.appendChild(doc.createTextNode(""))
977 root.appendChild(doc.createElement("i"))
981 doc.normalize()
990 doc.unlink()
993 doc = parseString("<doc/>")
994 root = doc.documentElement
995 root.appendChild(doc.createTextNode(""))
996 root.appendChild(doc.createTextNode("second"))
997 root.appendChild(doc.createTextNode(""))
998 root.appendChild(doc.createTextNode("fourth"))
999 root.appendChild(doc.createTextNode(""))
1003 doc.normalize()
1011 doc.unlink()
1014 doc = parseString("<doc>"
1031 root = doc.documentElement
1032 root.childNodes[0].appendChild(doc.createTextNode(""))
1033 root.childNodes[0].appendChild(doc.createTextNode("x"))
1034 root.childNodes[1].childNodes[0].appendChild(doc.createTextNode("x2"))
1035 root.childNodes[1].appendChild(doc.createTextNode("x3"))
1036 root.appendChild(doc.createTextNode(""))
1046 doc.normalize()
1073 doc.unlink()
1077 doc = parseString("<o>text</o>")
1078 text = doc.documentElement.childNodes[0]
1082 doc.unlink()
1085 doc = parseString("<o><i/>t</o>")
1086 node = doc.documentElement
1093 doc = parseString("<doc><?pi?>text?<elm/></doc>")
1094 root = doc.documentElement
1104 doc.unlink()
1107 doc = parseString(
1109 root = doc.documentElement
1114 self.confirm(root.parentNode is doc and
1119 doc.unlink()
1122 doc = parseString("<doc><e/><e/></doc>")
1123 children = doc.childNodes
1131 doc.unlink()
1134 doc = parseString('<foo>&#x20ac;</foo>')
1135 self.assertEqual(doc.toxml(),
1137 self.assertEqual(doc.toxml('utf-8'),
1139 self.assertEqual(doc.toxml('iso-8859-15'),
1141 self.assertEqual(doc.toxml('us-ascii'),
1143 self.assertEqual(doc.toxml('utf-16'),
1152 doc.unlink()
1185 def checkRenameNodeSharedConstraints(self, doc, node): argument
1187 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
1194 doc = parseString("<doc a='v'/>")
1195 elem = doc.documentElement
1200 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
1210 and attr.ownerDocument.isSameNode(doc)
1214 attr = doc.renameNode(attr, "http://xml.python.org/ns", "c")
1230 attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d")
1249 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
1265 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
1267 self.checkRenameNodeSharedConstraints(doc, attr)
1268 doc.unlink()
1271 doc = parseString("<doc/>")
1272 elem = doc.documentElement
1275 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
1281 and elem.ownerDocument.isSameNode(doc))
1284 elem = doc.renameNode(elem, "http://xml.python.org/ns", "b")
1290 and elem.ownerDocument.isSameNode(doc))
1293 elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c")
1299 and elem.ownerDocument.isSameNode(doc))
1302 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
1308 and elem.ownerDocument.isSameNode(doc))
1310 self.checkRenameNodeSharedConstraints(doc, elem)
1311 doc.unlink()
1316 doc = xml.dom.minidom.getDOMImplementation().createDocument(
1318 node = doc.createComment("comment")
1319 self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
1321 doc.unlink()
1324 doc = parseString("<doc>a</doc>")
1325 elem = doc.documentElement
1330 elem.appendChild(doc.createTextNode("b"))
1332 elem.insertBefore(doc.createCDATASection("c"), text)
1336 splitter = doc.createComment("comment")
1338 text2 = doc.createTextNode("d")
1343 x = doc.createElement("x")
1349 x = doc.createProcessingInstruction("y", "z")
1360 doc = parseString("<doc><e/></doc>")
1361 elem = doc.documentElement
1370 doc = parseString("<doc>a<e/>d</doc>")
1371 elem = doc.documentElement
1375 elem.insertBefore(doc.createTextNode("b"), splitter)
1376 elem.insertBefore(doc.createCDATASection("c"), text1)
1377 return doc, elem, text1, splitter, text2
1379 doc, elem, text1, splitter, text2 = setup()
1385 doc, elem, text1, splitter, text2 = setup()
1391 doc, elem, text1, splitter, text2 = setup()
1398 doc = parseString(
1415 elem = doc.documentElement
1431 doc = parseString("<doc a1='v' a2='w'/>")
1432 e = doc.documentElement
1435 self.confirm(doc.getElementById("v") is None
1439 self.confirm(e.isSameNode(doc.getElementById("v"))
1443 self.confirm(e.isSameNode(doc.getElementById("v"))
1444 and e.isSameNode(doc.getElementById("w"))
1448 a3 = doc.createAttribute("a1")
1451 self.confirm(doc.getElementById("v") is None
1452 and e.isSameNode(doc.getElementById("w"))
1457 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1458 self.confirm(e.isSameNode(doc.getElementById("w"))
1464 doc = parseString("<doc"
1468 e = doc.documentElement
1471 self.confirm(doc.getElementById("v") is None
1475 self.confirm(e.isSameNode(doc.getElementById("v"))
1479 self.confirm(e.isSameNode(doc.getElementById("v"))
1480 and e.isSameNode(doc.getElementById("w"))
1484 a3 = doc.createAttributeNS(NS1, "a1")
1487 self.confirm(e.isSameNode(doc.getElementById("w")))
1491 self.confirm(doc.getElementById("v") is None)
1493 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1494 self.confirm(e.isSameNode(doc.getElementById("w"))
1500 doc = parseString("<doc"
1504 e = doc.documentElement
1507 self.confirm(doc.getElementById("v") is None
1511 self.confirm(e.isSameNode(doc.getElementById("v"))
1515 self.confirm(e.isSameNode(doc.getElementById("v"))
1516 and e.isSameNode(doc.getElementById("w"))
1520 a3 = doc.createAttributeNS(NS1, "a1")
1523 self.confirm(e.isSameNode(doc.getElementById("w")))
1527 self.confirm(doc.getElementById("v") is None)
1529 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1530 self.confirm(e.isSameNode(doc.getElementById("w"))
1533 def assert_recursive_equal(self, doc, doc2): argument
1534 stack = [(doc, doc2)]
1565 self.assertTrue(n1.ownerDocument.isSameNode(doc))
1571 doc = parseString(sample)
1573 s = pickle.dumps(doc, proto)
1575 self.assert_recursive_equal(doc, doc2)
1578 doc = parseString(sample)
1579 doc2 = copy.deepcopy(doc)
1580 self.assert_recursive_equal(doc, doc2)
1583 doc = create_doc_without_doctype()
1584 doc.appendChild(doc.createComment("foo--bar"))
1585 self.assertRaises(ValueError, doc.toxml)
1589 doc = parseString("<element xmlns=''>\n"
1591 doc2 = parseString(doc.toxml())
1599 doc = parse(tstfile)
1600 title_tag = doc.documentElement.getElementsByTagName("TITLE")[0]
1601 self.assertRaises( xml.dom.NotFoundErr, doc.removeChild, title_tag)
1602 num_children_before = len(doc.childNodes)
1603 doc.removeChild(doc.childNodes[0])
1604 num_children_after = len(doc.childNodes)
1610 doc = parse(tstfile)
1611 pi = doc.createProcessingInstruction("y", "z")