• Home
  • Raw
  • Download

Lines Matching full:doc

19           "<!DOCTYPE doc PUBLIC 'http://xml.python.org/public'"
23 "]><doc attr='value'> text\n"
24 "<?pi sample?> <!-- comment --> <e/> </doc>")
30 return getDOMImplementation().createDocument(None, "doc", doctype)
33 doctype = getDOMImplementation().createDocumentType("doc", None, None)
50 doc = create_doc_without_doctype(doctype)
51 doctype.entities.item(0).ownerDocument = doc
52 doctype.notations.item(0).ownerDocument = doc
53 return doc
64 doc = Document()
65 self.assertFalse(doc.async_)
87 dom = parseString("<doc><foo/></doc>")
100 and root.toxml() == "<doc><element/><foo/></doc>"
112 and root.toxml() == "<doc><element/><foo/><element/></doc>"
125 "<doc><element/><foo/><bar/><element/></doc>"
130 dom = parseString("<doc/>")
431 def get_empty_nodelist_from_elements_by_tagName_ns_helper(self, doc, nsuri, argument
433 nodelist = doc.getElementsByTagNameNS(nsuri, lname)
437 doc = parseString('<doc/>')
439 doc, 'http://xml.python.org/namespaces/a', 'localname')
441 doc, '*', 'splat')
443 doc, 'http://xml.python.org/namespaces/a', '*')
445 doc = parseString('<doc xmlns="http://xml.python.org/splat"><e/></doc>')
447 doc, "http://xml.python.org/splat", "not-there")
449 doc, "*", "not-there")
451 doc, "http://somewhere.else.net/not-there", "e")
560 doc = parseString("<doc/>")
561 elem = doc.createElement("extra")
563 self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
565 doc.unlink()
588 doc = parseString("<doc a=''/>")
589 e = doc.documentElement
597 doc = parseString("<doc xmlns:a='http://xml.python.org/' a:b=''/>")
598 e = doc.documentElement
631 dom = parseString("<doc><foo/></doc>")
632 doc = dom.documentElement
633 self.assertTrue(doc.hasChildNodes())
634 dom2 = parseString("<doc/>")
659 dom = parseString("<doc attr='value'><foo/></doc>")
675 and clone.toxml() == '<doc attr="value"/>'
684 and clone.toxml() == '<doc attr="value"><foo/></doc>'
689 doc = parseString("<?xml version='1.0'?>\n"
691 "<!DOCTYPE doc [\n"
694 "<doc attr='value'/>")
695 doc2 = doc.cloneNode(0)
701 doc = parseString("<?xml version='1.0'?>\n"
703 "<!DOCTYPE doc [\n"
706 "<doc attr='value'/>")
707 doc2 = doc.cloneNode(1)
708 self.confirm(not (doc.isSameNode(doc2) or doc2.isSameNode(doc)),
710 self.confirm(len(doc.childNodes) == len(doc2.childNodes),
716 self.confirm(not doc.documentElement.isSameNode(doc2.documentElement),
718 if doc.doctype is not None:
723 self.confirm(not doc.doctype.isSameNode(doc2.doctype))
760 doc = create_doc_with_doctype()
761 clone = doc.doctype.cloneNode(1)
779 doc = create_doc_with_doctype()
780 clone = doc.doctype.cloneNode(0)
784 doc1 = parseString("<doc/>")
785 doc2 = parseString("<doc/>")
809 doc = parseString("<doc attr='value'/>")
810 attr = doc.documentElement.getAttributeNode("attr")
829 doc = parseString("<?target data?><doc/>")
830 pi = doc.firstChild
851 <doc>Don't let entities make you frown &smile;</doc>
894 doc = parseString("<doc/>")
895 root = doc.documentElement
896 root.appendChild(doc.createTextNode("first"))
897 root.appendChild(doc.createTextNode("second"))
901 doc.normalize()
907 doc.unlink()
909 doc = parseString("<doc/>")
910 root = doc.documentElement
911 root.appendChild(doc.createTextNode(""))
912 doc.normalize()
916 doc.unlink()
919 doc = parseString("<doc/>")
920 root = doc.documentElement
921 root.appendChild(doc.createTextNode("first"))
922 root.appendChild(doc.createTextNode("second"))
923 root.appendChild(doc.createElement("i"))
927 doc.normalize()
937 doc.unlink()
940 doc = parseString("<doc/>")
941 root = doc.documentElement
942 root.appendChild(doc.createTextNode("first"))
943 root.appendChild(doc.createTextNode(""))
947 doc.normalize()
955 doc.unlink()
958 doc = parseString("<doc/>")
959 root = doc.documentElement
960 root.appendChild(doc.createTextNode(""))
961 root.appendChild(doc.createTextNode("second"))
965 doc.normalize()
973 doc.unlink()
976 doc = parseString("<doc/>")
977 root = doc.documentElement
978 root.appendChild(doc.createElement("i"))
979 root.appendChild(doc.createTextNode(""))
980 root.appendChild(doc.createElement("i"))
984 doc.normalize()
993 doc.unlink()
996 doc = parseString("<doc/>")
997 root = doc.documentElement
998 root.appendChild(doc.createTextNode(""))
999 root.appendChild(doc.createTextNode("second"))
1000 root.appendChild(doc.createTextNode(""))
1001 root.appendChild(doc.createTextNode("fourth"))
1002 root.appendChild(doc.createTextNode(""))
1006 doc.normalize()
1014 doc.unlink()
1017 doc = parseString("<doc>"
1033 "</doc>")
1034 root = doc.documentElement
1035 root.childNodes[0].appendChild(doc.createTextNode(""))
1036 root.childNodes[0].appendChild(doc.createTextNode("x"))
1037 root.childNodes[1].childNodes[0].appendChild(doc.createTextNode("x2"))
1038 root.childNodes[1].appendChild(doc.createTextNode("x3"))
1039 root.appendChild(doc.createTextNode(""))
1049 doc.normalize()
1076 doc.unlink()
1080 doc = parseString("<o>text</o>")
1081 text = doc.documentElement.childNodes[0]
1085 doc.unlink()
1088 doc = parseString("<o><i/>t</o>")
1089 node = doc.documentElement
1096 doc = parseString("<doc><?pi?>text?<elm/></doc>")
1097 root = doc.documentElement
1107 doc.unlink()
1110 doc = parseString(
1111 "<doc><elm1><elm2/><elm2><elm3/></elm2></elm1></doc>")
1112 root = doc.documentElement
1117 self.confirm(root.parentNode is doc and
1122 doc.unlink()
1125 doc = parseString("<doc><e/><e/></doc>")
1126 children = doc.childNodes
1134 doc.unlink()
1137 doc = parseString('<foo>&#x20ac;</foo>')
1138 self.assertEqual(doc.toxml(),
1140 self.assertEqual(doc.toxml('utf-8'),
1142 self.assertEqual(doc.toxml('iso-8859-15'),
1144 self.assertEqual(doc.toxml('us-ascii'),
1146 self.assertEqual(doc.toxml('utf-16'),
1161 doc.unlink()
1164 doc = parseString('<foo>&#x20ac;</foo>')
1165 self.assertEqual(doc.toxml(),
1167 self.assertEqual(doc.toxml(standalone=None),
1169 self.assertEqual(doc.toxml(standalone=True),
1171 self.assertEqual(doc.toxml(standalone=False),
1173 self.assertEqual(doc.toxml('utf-8', True),
1177 doc.unlink()
1210 def checkRenameNodeSharedConstraints(self, doc, node): argument
1212 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
1214 doc2 = parseString("<doc/>")
1219 doc = parseString("<doc a='v'/>")
1220 elem = doc.documentElement
1225 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
1235 and attr.ownerDocument.isSameNode(doc)
1239 attr = doc.renameNode(attr, "http://xml.python.org/ns", "c")
1255 attr = doc.renameNode(attr, "http://xml.python.org/ns2", "p:d")
1274 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
1290 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
1292 self.checkRenameNodeSharedConstraints(doc, attr)
1293 doc.unlink()
1296 doc = parseString("<doc/>")
1297 elem = doc.documentElement
1300 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
1306 and elem.ownerDocument.isSameNode(doc))
1309 elem = doc.renameNode(elem, "http://xml.python.org/ns", "b")
1315 and elem.ownerDocument.isSameNode(doc))
1318 elem = doc.renameNode(elem, "http://xml.python.org/ns2", "p:c")
1324 and elem.ownerDocument.isSameNode(doc))
1327 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
1333 and elem.ownerDocument.isSameNode(doc))
1335 self.checkRenameNodeSharedConstraints(doc, elem)
1336 doc.unlink()
1341 doc = xml.dom.minidom.getDOMImplementation().createDocument(
1343 node = doc.createComment("comment")
1344 self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
1346 doc.unlink()
1349 doc = parseString("<doc>a</doc>")
1350 elem = doc.documentElement
1355 elem.appendChild(doc.createTextNode("b"))
1357 elem.insertBefore(doc.createCDATASection("c"), text)
1361 splitter = doc.createComment("comment")
1363 text2 = doc.createTextNode("d")
1368 x = doc.createElement("x")
1374 x = doc.createProcessingInstruction("y", "z")
1385 doc = parseString("<doc><e/></doc>")
1386 elem = doc.documentElement
1395 doc = parseString("<doc>a<e/>d</doc>")
1396 elem = doc.documentElement
1400 elem.insertBefore(doc.createTextNode("b"), splitter)
1401 elem.insertBefore(doc.createCDATASection("c"), text1)
1402 return doc, elem, text1, splitter, text2
1404 doc, elem, text1, splitter, text2 = setup()
1410 doc, elem, text1, splitter, text2 = setup()
1416 doc, elem, text1, splitter, text2 = setup()
1423 doc = parseString(
1424 "<!DOCTYPE doc [\n"
1427 " <!ATTLIST doc id ID #IMPLIED \n"
1437 "]><doc id='name' notid='name' text='splat!' enum='b'"
1440 elem = doc.documentElement
1456 doc = parseString("<doc a1='v' a2='w'/>")
1457 e = doc.documentElement
1460 self.confirm(doc.getElementById("v") is None
1464 self.confirm(e.isSameNode(doc.getElementById("v"))
1468 self.confirm(e.isSameNode(doc.getElementById("v"))
1469 and e.isSameNode(doc.getElementById("w"))
1473 a3 = doc.createAttribute("a1")
1476 self.confirm(doc.getElementById("v") is None
1477 and e.isSameNode(doc.getElementById("w"))
1482 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1483 self.confirm(e.isSameNode(doc.getElementById("w"))
1489 doc = parseString("<doc"
1493 e = doc.documentElement
1496 self.confirm(doc.getElementById("v") is None
1500 self.confirm(e.isSameNode(doc.getElementById("v"))
1504 self.confirm(e.isSameNode(doc.getElementById("v"))
1505 and e.isSameNode(doc.getElementById("w"))
1509 a3 = doc.createAttributeNS(NS1, "a1")
1512 self.confirm(e.isSameNode(doc.getElementById("w")))
1516 self.confirm(doc.getElementById("v") is None)
1518 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1519 self.confirm(e.isSameNode(doc.getElementById("w"))
1525 doc = parseString("<doc"
1529 e = doc.documentElement
1532 self.confirm(doc.getElementById("v") is None
1536 self.confirm(e.isSameNode(doc.getElementById("v"))
1540 self.confirm(e.isSameNode(doc.getElementById("v"))
1541 and e.isSameNode(doc.getElementById("w"))
1545 a3 = doc.createAttributeNS(NS1, "a1")
1548 self.confirm(e.isSameNode(doc.getElementById("w")))
1552 self.confirm(doc.getElementById("v") is None)
1554 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1555 self.confirm(e.isSameNode(doc.getElementById("w"))
1558 def assert_recursive_equal(self, doc, doc2): argument
1559 stack = [(doc, doc2)]
1590 self.assertTrue(n1.ownerDocument.isSameNode(doc))
1596 doc = parseString(sample)
1598 s = pickle.dumps(doc, proto)
1600 self.assert_recursive_equal(doc, doc2)
1603 doc = parseString(sample)
1604 doc2 = copy.deepcopy(doc)
1605 self.assert_recursive_equal(doc, doc2)
1608 doc = create_doc_without_doctype()
1609 doc.appendChild(doc.createComment("foo--bar"))
1610 self.assertRaises(ValueError, doc.toxml)
1614 doc = parseString("<element xmlns=''>\n"
1616 doc2 = parseString(doc.toxml())
1629 doc = parse(tstfile)
1630 title_tag = doc.documentElement.getElementsByTagName("TITLE")[0]
1631 self.assertRaises( xml.dom.NotFoundErr, doc.removeChild, title_tag)
1632 num_children_before = len(doc.childNodes)
1633 doc.removeChild(doc.childNodes[0])
1634 num_children_after = len(doc.childNodes)
1640 doc = parse(tstfile)
1641 pi = doc.createProcessingInstruction("y", "z")
1646 doc = parseString(xml_str)
1648 doc.writexml(output)
1653 doc = parseString(xml_str)
1654 self.assertEqual(doc.toxml(), xml_str)
1658 doc = parseString(xml_str)
1659 self.assertEqual(doc.toprettyxml(),
1665 doc = parseString(xml_str)
1666 self.assertEqual(doc.toprettyxml(),