• Home
  • Raw
  • Download

Lines Matching full:parser

20         self.parser = expat.ParserCreate(namespace_separator='!')
23 self.assertIs(self.parser.buffer_text, False)
25 self.parser.buffer_text = x
26 self.assertIs(self.parser.buffer_text, bool(x))
29 self.assertIs(self.parser.namespace_prefixes, False)
31 self.parser.namespace_prefixes = x
32 self.assertIs(self.parser.namespace_prefixes, bool(x))
35 self.assertIs(self.parser.ordered_attributes, False)
37 self.parser.ordered_attributes = x
38 self.assertIs(self.parser.ordered_attributes, bool(x))
41 self.assertIs(self.parser.specified_attributes, False)
43 self.parser.specified_attributes = x
44 self.assertIs(self.parser.specified_attributes, bool(x))
48 self.parser.returns_unicode = 1
50 self.parser.returns_unicode
53 self.assertRaises(TypeError, setattr, self.parser, range(0xF), 0)
54 self.assertRaises(TypeError, self.parser.__setattr__, range(0xF), 0)
55 self.assertRaises(TypeError, getattr, self.parser, range(0xF))
183 def _hookup_callbacks(self, parser, handler): argument
186 self.handler_names on the given parser.
189 setattr(parser, name, getattr(handler, name))
231 parser = expat.ParserCreate(namespace_separator='!')
232 self._hookup_callbacks(parser, out)
234 parser.Parse(data, True)
239 self.assertRaises(AttributeError, getattr, parser, '\uD800')
243 parser = expat.ParserCreate(namespace_separator='!')
244 self._hookup_callbacks(parser, out)
246 parser.Parse(data.decode('iso-8859-1'), True)
254 parser = expat.ParserCreate(namespace_separator='!')
255 self._hookup_callbacks(parser, out)
258 parser.ParseFile(file)
264 parser = expat.ParserCreate()
266 parser.ParseFile(file)
271 parser.ParseFile(file)
329 def __init__(self, parser): argument
330 self.parser = parser
334 external_parser = self.parser.ExternalEntityParserCreate("")
338 parser = expat.ParserCreate(namespace_separator='!')
339 parser.buffer_text = 1
340 out = ExternalOutputter(parser)
341 parser.ExternalEntityRefHandler = out.ExternalEntityRefHandler
342 parser.Parse(data, True)
349 self.parser = expat.ParserCreate()
350 self.parser.buffer_text = 1
351 self.parser.CharacterDataHandler = self.CharacterDataHandler
365 self.parser.buffer_text = 1
367 self.parser.buffer_text = 0
377 setattr(self.parser, name, getattr(self, name))
380 parser = expat.ParserCreate()
381 self.assertFalse(parser.buffer_text)
385 self.assertTrue(self.parser.buffer_text)
386 self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
394 self.parser.Parse(b"<a>1<b buffer-text='no'/>2\n3<c buffer-text='yes'/>4\n5</a>", True)
400 self.parser.Parse(b"<a>1<b/>&lt;2&gt;<c/>&#32;\n&#x20;3</a>", True)
406 self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
412 self.parser.CharacterDataHandler = None
413 self.parser.Parse(b"<a>1<b/>2<c/>3</a>", True)
419 self.parser.Parse(b"<a>1<b></b>2<c/>3</a>", True)
426 self.parser.Parse(b"<a>1<b/>2<c></c>345</a> ", True)
434 self.parser.Parse(b"<a>1<b/>2<c></c>3<!--abc-->4<!--def-->5</a> ", True)
451 parser = expat.ParserCreate()
452 parser.StartElementHandler = self.StartElementHandler
454 parser.Parse(b"<a><b><c/></b></a>", True)
483 self.parser.CurrentByteIndex,
484 self.parser.CurrentLineNumber,
485 self.parser.CurrentColumnNumber)
487 'too many parser events')
494 self.parser = expat.ParserCreate()
495 self.parser.StartElementHandler = self.StartElementHandler
496 self.parser.EndElementHandler = self.EndElementHandler
502 self.parser.Parse(xml, True)
519 parser = expat.ParserCreate()
520 parser.CharacterDataHandler = handler
522 self.assertRaises(Exception, parser.Parse, xml.encode('iso8859'))
536 parser = expat.ParserCreate()
537 parser.buffer_text = 1
539 parser.buffer_size = -1
541 parser.buffer_size = 0
543 parser.buffer_size = sys.maxsize + 1
545 parser.buffer_size = 512.0
550 parser = expat.ParserCreate()
551 parser.CharacterDataHandler = self.counting_handler
552 parser.buffer_size = 512
553 parser.buffer_text = 1
558 parser.Parse(xml1)
562 parser.buffer_size = parser.buffer_size
566 parser.Parse(xml2)
574 parser = expat.ParserCreate()
575 parser.CharacterDataHandler = self.counting_handler
576 parser.buffer_text = 1
577 parser.buffer_size = 1024
578 self.assertEqual(parser.buffer_size, 1024)
582 parser.Parse(xml1, False)
583 self.assertEqual(parser.buffer_size, 1024)
587 parser.buffer_text = 0
588 self.assertFalse(parser.buffer_text)
589 self.assertEqual(parser.buffer_size, 1024)
591 parser.Parse(xml2, False)
594 parser.buffer_text = 1
595 self.assertTrue(parser.buffer_text)
596 self.assertEqual(parser.buffer_size, 1024)
597 parser.Parse(xml3, True)
605 parser = expat.ParserCreate()
606 parser.CharacterDataHandler = self.counting_handler
607 parser.buffer_size = 1024
608 parser.buffer_text = 1
611 parser.Parse(xml)
617 parser = expat.ParserCreate()
618 parser.CharacterDataHandler = self.counting_handler
619 parser.buffer_text = 1
620 parser.buffer_size = 1024
621 self.assertEqual(parser.buffer_size, 1024)
624 parser.Parse(xml1, False)
625 parser.buffer_size *= 2
626 self.assertEqual(parser.buffer_size, 2048)
627 parser.Parse(xml2, True)
633 parser = expat.ParserCreate()
634 parser.CharacterDataHandler = self.counting_handler
635 parser.buffer_text = 1
636 parser.buffer_size = 2048
637 self.assertEqual(parser.buffer_size, 2048)
640 parser.Parse(xml1, False)
641 parser.buffer_size = parser.buffer_size // 2
642 self.assertEqual(parser.buffer_size, 1024)
643 parser.Parse(xml2, True)
649 parser = expat.ParserCreate()
651 parser.Parse(xml, True)
659 parser = expat.ParserCreate()
662 parser.Parse(xml, True)
672 parser = expat.ParserCreate()
674 parser.Parse(xml, True)
683 Tests for the UseForeignDTD method of expat parser objects.
696 parser = expat.ParserCreate()
697 parser.UseForeignDTD(True)
698 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
699 parser.ExternalEntityRefHandler = resolve_entity
700 parser.Parse(b"<?xml version='1.0'?><element/>")
706 parser = expat.ParserCreate()
707 parser.UseForeignDTD()
708 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
709 parser.ExternalEntityRefHandler = resolve_entity
710 parser.Parse(b"<?xml version='1.0'?><element/>")
724 parser = expat.ParserCreate()
725 parser.UseForeignDTD(True)
726 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
727 parser.ExternalEntityRefHandler = resolve_entity
728 parser.Parse(