• Home
  • Raw
  • Download

Lines Matching refs:dom

9 import xml.dom
10 import xml.dom.minidom
13 from xml.dom.minidom import parse, Node, Document, parseString
14 from xml.dom.minidom import getDOMImplementation
36 notation = xml.dom.minidom.Notation("my-notation", None,
39 entity = xml.dom.minidom.Entity("my-entity", None,
64 dom = parse(StringIO(open(tstfile).read()))
65 dom.unlink()
66 self.confirm(isinstance(dom,Document))
69 dom = parse(tstfile)
70 self.confirm(dom.getElementsByTagName("LI") == \
71 dom.documentElement.getElementsByTagName("LI"))
72 dom.unlink()
75 dom = parseString("<doc><foo/></doc>")
76 root = dom.documentElement
78 nelem = dom.createElement("element")
90 nelem = dom.createElement("element")
102 nelem2 = dom.createElement("bar")
115 dom.unlink()
118 dom = parseString("<doc/>")
119 orig = dom.createTextNode("original")
120 c1 = dom.createTextNode("foo")
121 c2 = dom.createTextNode("bar")
122 c3 = dom.createTextNode("bat")
123 dom.documentElement.appendChild(orig)
124 frag = dom.createDocumentFragment()
128 return dom, orig, c1, c2, c3, frag
131 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
132 dom.documentElement.insertBefore(frag, None)
133 self.confirm(tuple(dom.documentElement.childNodes) ==
137 dom.unlink()
139 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
140 dom.documentElement.insertBefore(frag, orig)
141 self.confirm(tuple(dom.documentElement.childNodes) ==
145 dom.unlink()
148 dom = parse(tstfile)
149 dom.documentElement.appendChild(dom.createComment(u"Hello"))
150 self.confirm(dom.documentElement.childNodes[-1].nodeName == "#comment")
151 self.confirm(dom.documentElement.childNodes[-1].data == "Hello")
152 dom.unlink()
155 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
156 dom.documentElement.appendChild(frag)
157 self.confirm(tuple(dom.documentElement.childNodes) ==
161 dom.unlink()
164 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
165 dom.documentElement.replaceChild(frag, orig)
167 self.confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3),
170 dom.unlink()
173 dom = Document()
174 elem = dom.createElement('element')
175 text = dom.createTextNode('text')
176 self.assertRaises(xml.dom.HierarchyRequestErr, dom.appendChild, text)
178 dom.appendChild(elem)
179 self.assertRaises(xml.dom.HierarchyRequestErr, dom.insertBefore, text,
181 self.assertRaises(xml.dom.HierarchyRequestErr, dom.replaceChild, text,
185 self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItem,
187 self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItemNS,
191 dom.unlink()
194 dom = Document()
195 elem = dom.createElement('element')
199 self.confirm(a.ownerDocument is dom,
208 dom.unlink()
211 dom = parse(tstfile)
212 self.confirm(dom)# should not be zero
213 dom.appendChild(dom.createComment("foo"))
214 self.confirm(not dom.childNodes[-1].childNodes)
215 dom.unlink()
218 dom = parse(tstfile)
219 dom.unlink()
222 dom = Document()
223 dom.appendChild(dom.createElement("abc"))
224 self.confirm(dom.documentElement)
225 dom.unlink()
228 dom = parseString("<abc/>")
229 el = dom.documentElement
233 self.confirm(a.ownerDocument is dom,
235 self.confirm(a.ownerElement is dom.documentElement,
237 dom.unlink()
240 dom = parseString("<abc/>")
241 el = dom.documentElement
245 dom.unlink()
248 dom = Document()
249 child = dom.appendChild(dom.createElement("abc"))
266 dom.unlink()
269 dom = Document()
270 child = dom.appendChild(dom.createElement("abc"))
277 dom.unlink()
280 dom = Document()
281 child = dom.appendChild(dom.createElement("abc"))
287 dom.unlink()
290 dom = Document()
291 child = dom.appendChild(
292 dom.createElementNS("http://www.python.org", "python:abc"))
299 dom.unlink()
302 dom = Document()
303 child = dom.appendChild(dom.createElement("foo"))
310 dom.unlink()
313 dom = parseString("<abc/>")
314 el = dom.documentElement
348 dom.unlink()
354 dom = parseString(d)
355 elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom",
363 dom.unlink()
388 dom = Document()
389 el = dom.appendChild(dom.createElement("abc"))
393 dom.unlink()
396 dom = Document()
397 el = dom.appendChild(dom.createElement(u"abc"))
401 dom.unlink()
404 dom = Document()
405 el = dom.appendChild(
406 dom.createElementNS(u"http://www.slashdot.org", u"slash:abc"))
411 dom.unlink()
414 dom = Document()
415 el = dom.appendChild(dom.createElement(u"abc"))
418 dom.unlink()
422 dom = parseString(str)
423 domstr = dom.toxml()
424 dom.unlink()
429 dom = parseString(str)
430 domstr = dom.toprettyxml(newl="\r\n")
431 dom.unlink()
450 dom = Document()
451 elem = dom.createElement(u'elem')
452 elem.appendChild(dom.createTextNode(u'TEXT'))
453 elem.appendChild(dom.createTextNode(u'TEXT'))
454 dom.appendChild(elem)
456 self.assertEqual(dom.toprettyxml(),
462 dom = parseString(str)
463 dom2 = parseString(dom.toprettyxml())
465 dom.getElementsByTagName('B')[0].childNodes[0].toxml(),
469 dom = parseString('<e><?mypi \t\n data \t\n ?></e>')
470 pi = dom.documentElement.firstChild
481 and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE)
487 self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
498 self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItem, "a")
507 self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItemNS,
531 dom = parseString("<doc attr='value'><foo/></doc>")
532 root = dom.documentElement
540 return dom, clone
543 dom, clone = self._setupCloneElement(0)
549 dom.unlink()
552 dom, clone = self._setupCloneElement(1)
558 dom.unlink()
658 self.assertRaises(xml.dom.NotSupportedErr, doc1.importNode, doc2, deep)
669 self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
675 self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
958 from xml.dom import pulldom
1016 dom = Document()
1017 n = dom.createElement('e')
1037 dom.unlink()
1041 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
1044 self.assertRaises(xml.dom.WrongDocumentErr, doc2.renameNode, node,
1045 xml.dom.EMPTY_NAMESPACE, "foo")
1054 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
1058 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
1103 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
1107 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
1119 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
1129 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
1133 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
1156 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
1160 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
1170 doc = xml.dom.minidom.getDOMImplementation().createDocument(
1171 xml.dom.EMPTY_NAMESPACE, "e", None)
1173 self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
1174 xml.dom.EMPTY_NAMESPACE, "foo")
1276 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1282 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1311 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1347 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1383 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1445 self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)