Python xml.dom.pulldom.PROCESSING_INSTRUCTION Examples
The following are 7
code examples of xml.dom.pulldom.PROCESSING_INSTRUCTION().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xml.dom.pulldom
, or try the search function
.
Example #1
Source File: test_pulldom.py From medicare-demo with Apache License 2.0 | 5 votes |
def testProcessingInstruction(self): piText = [] for event, node in pulldom.parse(self.testFile): if event == pulldom.PROCESSING_INSTRUCTION: piText.append(node.data) try: result = u"".join(piText) # Weird how the repr for PI data is different from text and char data. # Still, the whole xml.dom.* and xml.sax.* hierarchy is rather a # labyrinthine mess under jython, mostly because it's so old, and # yet survived through major evolutionary changes in both jython and java. self.failUnlessEqual(repr(result), r"u'ΛΜΝΞΟ'") except Exception, x: self.fail("Unexpected exception joining pi data pieces: %s" % str(x))
Example #2
Source File: test_pulldom.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def testProcessingInstruction(self): piText = [] for event, node in pulldom.parse(self.testFile): if event == pulldom.PROCESSING_INSTRUCTION: piText.append(node.data) try: result = u"".join(piText) # Weird how the repr for PI data is different from text and char data. # Still, the whole xml.dom.* and xml.sax.* hierarchy is rather a # labyrinthine mess under jython, mostly because it's so old, and # yet survived through major evolutionary changes in both jython and java. self.failUnlessEqual(repr(result), r"u'ΛΜΝΞΟ'") except Exception, x: self.fail("Unexpected exception joining pi data pieces: %s" % str(x))
Example #3
Source File: test_pulldom.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def testProcessingInstruction(self): piText = [] for event, node in pulldom.parse(self.testFile): if event == pulldom.PROCESSING_INSTRUCTION: piText.append(node.data) try: result = u"".join(piText) # Weird how the repr for PI data is different from text and char data. # Still, the whole xml.dom.* and xml.sax.* hierarchy is rather a # labyrinthine mess under jython, mostly because it's so old, and # yet survived through major evolutionary changes in both jython and java. self.failUnlessEqual(repr(result), r"u'ΛΜΝΞΟ'") except Exception, x: self.fail("Unexpected exception joining pi data pieces: %s" % str(x))
Example #4
Source File: test_pulldom.py From Fluid-Designer with GNU General Public License v3.0 | 4 votes |
def _test_thorough(self, pd, before_root=True): """Test some of the hard-to-reach parts of the parser, using a mock parser.""" evt, node = next(pd) self.assertEqual(pulldom.START_DOCUMENT, evt) # Just check the node is a Document: self.assertTrue(hasattr(node, "createElement")) if before_root: evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.CHARACTERS, evt) self.assertEqual("text", node.data) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_DOCUMENT, evt)
Example #5
Source File: test_pulldom.py From ironpython3 with Apache License 2.0 | 4 votes |
def _test_thorough(self, pd, before_root=True): """Test some of the hard-to-reach parts of the parser, using a mock parser.""" evt, node = next(pd) self.assertEqual(pulldom.START_DOCUMENT, evt) # Just check the node is a Document: self.assertTrue(hasattr(node, "createElement")) if before_root: evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.CHARACTERS, evt) self.assertEqual("text", node.data) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_DOCUMENT, evt)
Example #6
Source File: test_pulldom.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 4 votes |
def _test_thorough(self, pd, before_root=True): """Test some of the hard-to-reach parts of the parser, using a mock parser.""" evt, node = next(pd) self.assertEqual(pulldom.START_DOCUMENT, evt) # Just check the node is a Document: self.assertTrue(hasattr(node, "createElement")) if before_root: evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.CHARACTERS, evt) self.assertEqual("text", node.data) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_DOCUMENT, evt)
Example #7
Source File: test_pulldom.py From android_universal with MIT License | 4 votes |
def _test_thorough(self, pd, before_root=True): """Test some of the hard-to-reach parts of the parser, using a mock parser.""" evt, node = next(pd) self.assertEqual(pulldom.START_DOCUMENT, evt) # Just check the node is a Document: self.assertTrue(hasattr(node, "createElement")) if before_root: evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.COMMENT, evt) self.assertEqual("a comment", node.data) evt, node = next(pd) self.assertEqual(pulldom.PROCESSING_INSTRUCTION, evt) self.assertEqual("target", node.target) self.assertEqual("data", node.data) evt, node = next(pd) self.assertEqual(pulldom.START_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.CHARACTERS, evt) self.assertEqual("text", node.data) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("p", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_ELEMENT, evt) self.assertEqual("html", node.tagName) evt, node = next(pd) self.assertEqual(pulldom.END_DOCUMENT, evt)