• Home
  • Raw
  • Download

Lines Matching refs:dom

9 import xml.dom.minidom
11 from xml.dom.minidom import parse, Node, Document, parseString
12 from xml.dom.minidom import getDOMImplementation
34 notation = xml.dom.minidom.Notation("my-notation", None,
37 entity = xml.dom.minidom.Entity("my-entity", None,
68 dom = parse(file)
69 dom.unlink()
70 self.confirm(isinstance(dom, Document))
74 dom = parse(file)
75 dom.unlink()
76 self.confirm(isinstance(dom, Document))
79 dom = parse(tstfile)
80 self.confirm(dom.getElementsByTagName("LI") == \
81 dom.documentElement.getElementsByTagName("LI"))
82 dom.unlink()
85 dom = parseString("<doc><foo/></doc>")
86 root = dom.documentElement
88 nelem = dom.createElement("element")
100 nelem = dom.createElement("element")
112 nelem2 = dom.createElement("bar")
125 dom.unlink()
128 dom = parseString("<doc/>")
129 orig = dom.createTextNode("original")
130 c1 = dom.createTextNode("foo")
131 c2 = dom.createTextNode("bar")
132 c3 = dom.createTextNode("bat")
133 dom.documentElement.appendChild(orig)
134 frag = dom.createDocumentFragment()
138 return dom, orig, c1, c2, c3, frag
141 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
142 dom.documentElement.insertBefore(frag, None)
143 self.confirm(tuple(dom.documentElement.childNodes) ==
147 dom.unlink()
149 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
150 dom.documentElement.insertBefore(frag, orig)
151 self.confirm(tuple(dom.documentElement.childNodes) ==
155 dom.unlink()
158 dom = parse(tstfile)
159 dom.documentElement.appendChild(dom.createComment("Hello"))
160 self.confirm(dom.documentElement.childNodes[-1].nodeName == "#comment")
161 self.confirm(dom.documentElement.childNodes[-1].data == "Hello")
162 dom.unlink()
165 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
166 dom.documentElement.appendChild(frag)
167 self.confirm(tuple(dom.documentElement.childNodes) ==
171 dom.unlink()
174 dom, orig, c1, c2, c3, frag = self._create_fragment_test_nodes()
175 dom.documentElement.replaceChild(frag, orig)
177 self.confirm(tuple(dom.documentElement.childNodes) == (c1, c2, c3),
180 dom.unlink()
183 dom = Document()
184 elem = dom.createElement('element')
185 text = dom.createTextNode('text')
186 self.assertRaises(xml.dom.HierarchyRequestErr, dom.appendChild, text)
188 dom.appendChild(elem)
189 self.assertRaises(xml.dom.HierarchyRequestErr, dom.insertBefore, text,
191 self.assertRaises(xml.dom.HierarchyRequestErr, dom.replaceChild, text,
195 self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItem,
197 self.assertRaises(xml.dom.HierarchyRequestErr, nodemap.setNamedItemNS,
201 dom.unlink()
204 dom = Document()
205 elem = dom.createElement('element')
209 self.confirm(a.ownerDocument is dom,
218 dom.unlink()
221 dom = parse(tstfile)
222 self.confirm(dom)# should not be zero
223 dom.appendChild(dom.createComment("foo"))
224 self.confirm(not dom.childNodes[-1].childNodes)
225 dom.unlink()
228 dom = parse(tstfile)
229 self.assertTrue(dom.childNodes)
230 dom.unlink()
231 self.assertFalse(dom.childNodes)
234 with parse(tstfile) as dom:
235 self.assertTrue(dom.childNodes)
236 self.assertFalse(dom.childNodes)
239 dom = Document()
240 dom.appendChild(dom.createElement("abc"))
241 self.confirm(dom.documentElement)
242 dom.unlink()
245 dom = parseString("<abc/>")
246 el = dom.documentElement
250 self.confirm(a.ownerDocument is dom,
252 self.confirm(a.ownerElement is dom.documentElement,
254 dom.unlink()
257 dom = parseString("<abc/>")
258 el = dom.documentElement
262 dom.unlink()
265 dom = Document()
266 child = dom.appendChild(dom.createElement("abc"))
283 dom.unlink()
286 dom = Document()
287 child = dom.appendChild(dom.createElement("abc"))
294 dom.unlink()
297 dom = Document()
298 child = dom.appendChild(dom.createElement("abc"))
302 self.assertRaises(xml.dom.NotFoundErr, child.removeAttribute, "foo")
305 dom.unlink()
308 dom = Document()
309 child = dom.appendChild(
310 dom.createElementNS("http://www.python.org", "python:abc"))
314 self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNS,
319 dom.unlink()
322 dom = Document()
323 child = dom.appendChild(dom.createElement("foo"))
327 self.assertRaises(xml.dom.NotFoundErr, child.removeAttributeNode,
335 self.assertRaises(xml.dom.NotFoundErr, child2.removeAttributeNode,
337 dom.unlink()
340 dom = Document()
341 child = dom.appendChild(dom.createElement("foo"))
346 dom = parseString("<abc/>")
347 el = dom.documentElement
381 dom.unlink()
393 dom = Document()
394 child = dom.appendChild(
395 dom.createElementNS("http://www.python.org", "python:abc"))
399 dom = Document()
400 child = dom.appendChild(
401 dom.createElementNS("http://www.python.org", "python:abc"))
408 child2 = child.appendChild(dom.createElement('abc'))
418 dom = parseString(d)
419 elems = dom.getElementsByTagNameNS("http://pyxml.sf.net/minidom",
427 dom.unlink()
452 dom = Document()
453 el = dom.appendChild(dom.createElement("abc"))
457 dom.unlink()
460 dom = Document()
461 el = dom.appendChild(dom.createElement("abc"))
465 dom.unlink()
468 dom = Document()
469 el = dom.appendChild(
470 dom.createElementNS("http://www.slashdot.org", "slash:abc"))
475 dom.unlink()
478 dom = Document()
479 el = dom.appendChild(dom.createElement("abc"))
482 dom.unlink()
488 dom = parseString(str)
489 domstr = dom.toxml()
490 dom.unlink()
495 dom = parseString(str)
496 domstr = dom.toprettyxml(newl="\r\n")
497 dom.unlink()
516 dom = Document()
517 elem = dom.createElement('elem')
518 elem.appendChild(dom.createTextNode('TEXT'))
519 elem.appendChild(dom.createTextNode('TEXT'))
520 dom.appendChild(elem)
522 self.assertEqual(dom.toprettyxml(),
528 dom = parseString(str)
529 dom2 = parseString(dom.toprettyxml())
531 dom.getElementsByTagName('B')[0].childNodes[0].toxml(),
535 dom = parseString('<e><?mypi \t\n data \t\n ?></e>')
536 pi = dom.documentElement.firstChild
547 and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE)
561 self.assertRaises(xml.dom.HierarchyRequestErr, doc.appendChild, elem)
592 self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItem, "a")
601 self.assertRaises(xml.dom.NotFoundErr, attrs.removeNamedItemNS,
629 dom = parseString("<doc><foo/></doc>")
630 doc = dom.documentElement
657 dom = parseString("<doc attr='value'><foo/></doc>")
658 root = dom.documentElement
666 return dom, clone
669 dom, clone = self._setupCloneElement(0)
675 dom.unlink()
678 dom, clone = self._setupCloneElement(1)
684 dom.unlink()
784 self.assertRaises(xml.dom.NotSupportedErr, doc1.importNode, doc2, deep)
795 self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
801 self.assertRaises(xml.dom.NotSupportedErr, target.importNode,
843 document = xml.dom.minidom.parseString("""
871 operation = xml.dom.UserDataHandler.NODE_IMPORTED
878 operation = xml.dom.UserDataHandler.NODE_CLONED
1179 dom = Document()
1180 n = dom.createElement('e')
1200 dom.unlink()
1204 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, node,
1207 self.assertRaises(xml.dom.WrongDocumentErr, doc2.renameNode, node,
1208 xml.dom.EMPTY_NAMESPACE, "foo")
1217 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
1221 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
1266 attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
1270 and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
1282 self.assertRaises(xml.dom.NamespaceErr, doc.renameNode, attr,
1292 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
1296 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
1319 elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
1323 and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
1333 doc = xml.dom.minidom.getDOMImplementation().createDocument(
1334 xml.dom.EMPTY_NAMESPACE, "e", None)
1336 self.assertRaises(xml.dom.NotSupportedErr, doc.renameNode, node,
1337 xml.dom.EMPTY_NAMESPACE, "foo")
1439 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1445 and t.namespace == xml.dom.EMPTY_NAMESPACE)
1474 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1510 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1546 doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
1609 self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)
1618 self.assertRaises( xml.dom.NotFoundErr, doc.removeChild, title_tag)