Lines Matching refs:parser
15 self.parser = expat.ParserCreate(namespace_separator='!')
18 self.assertIs(self.parser.buffer_text, False)
20 self.parser.buffer_text = x
21 self.assertIs(self.parser.buffer_text, bool(x))
24 self.assertIs(self.parser.namespace_prefixes, False)
26 self.parser.namespace_prefixes = x
27 self.assertIs(self.parser.namespace_prefixes, bool(x))
30 self.assertIs(self.parser.returns_unicode, test_support.have_unicode)
32 self.parser.returns_unicode = x
33 self.assertIs(self.parser.returns_unicode, bool(x))
36 self.assertIs(self.parser.ordered_attributes, False)
38 self.parser.ordered_attributes = x
39 self.assertIs(self.parser.ordered_attributes, bool(x))
42 self.assertIs(self.parser.specified_attributes, False)
44 self.parser.specified_attributes = x
45 self.assertIs(self.parser.specified_attributes, bool(x))
49 self.parser.foo = 1
51 self.parser.foo
151 parser = expat.ParserCreate(namespace_separator='!')
153 setattr(parser, name, getattr(out, name))
154 parser.returns_unicode = 0
155 parser.Parse(data, 1)
180 parser = expat.ParserCreate(namespace_separator='!')
181 parser.returns_unicode = 1
183 setattr(parser, name, getattr(out, name))
185 parser.Parse(data, 1)
209 parser = expat.ParserCreate(namespace_separator='!')
210 parser.returns_unicode = 1
212 setattr(parser, name, getattr(out, name))
215 parser.ParseFile(file)
240 parser = expat.ParserCreate()
242 parser.ParseFile(fp)
247 parser = expat.ParserCreate()
249 parser.ParseFile(file)
254 parser.ParseFile(file)
313 self.parser = expat.ParserCreate()
314 self.parser.buffer_text = 1
315 self.parser.CharacterDataHandler = self.CharacterDataHandler
329 self.parser.buffer_text = 1
331 self.parser.buffer_text = 0
341 setattr(self.parser, name, getattr(self, name))
344 parser = expat.ParserCreate()
345 self.assertFalse(parser.buffer_text)
349 self.assertTrue(self.parser.buffer_text)
350 self.parser.Parse("<a>1<b/>2<c/>3</a>", 1)
358 self.parser.Parse("<a>1<b buffer-text='no'/>2\n3<c buffer-text='yes'/>4\n5</a>", 1)
364 self.parser.Parse("<a>1<b/><2><c/> \n 3</a>", 1)
370 self.parser.Parse("<a>1<b/>2<c/>3</a>", 1)
376 self.parser.CharacterDataHandler = None
377 self.parser.Parse("<a>1<b/>2<c/>3</a>", 1)
383 self.parser.Parse("<a>1<b></b>2<c/>3</a>", 1)
390 self.parser.Parse("<a>1<b/>2<c></c>345</a> ", 1)
398 self.parser.Parse("<a>1<b/>2<c></c>3<!--abc-->4<!--def-->5</a> ", 1)
411 parser = expat.ParserCreate()
412 parser.StartElementHandler = self.StartElementHandler
414 parser.Parse("<a><b><c/></b></a>", 1)
432 self.parser.CurrentByteIndex,
433 self.parser.CurrentLineNumber,
434 self.parser.CurrentColumnNumber)
443 self.parser = expat.ParserCreate()
444 self.parser.StartElementHandler = self.StartElementHandler
445 self.parser.EndElementHandler = self.EndElementHandler
451 self.parser.Parse(xml, 1)
468 parser = expat.ParserCreate()
469 parser.CharacterDataHandler = handler
471 self.assertRaises(Exception, parser.Parse, xml)
485 parser = expat.ParserCreate()
486 parser.buffer_text = 1
488 parser.buffer_size = -1
490 parser.buffer_size = 0
492 parser.buffer_size = 512.0
494 parser.buffer_size = sys.maxint+1
499 parser = expat.ParserCreate()
500 parser.CharacterDataHandler = self.counting_handler
501 parser.buffer_size = 512
502 parser.buffer_text = 1
507 parser.Parse(xml1)
511 parser.buffer_size = parser.buffer_size
515 parser.Parse(xml2)
523 parser = expat.ParserCreate()
524 parser.CharacterDataHandler = self.counting_handler
525 parser.buffer_text = 1
526 parser.buffer_size = 1024
527 self.assertEqual(parser.buffer_size, 1024)
531 parser.Parse(xml1, 0)
532 self.assertEqual(parser.buffer_size, 1024)
536 parser.buffer_text = 0
537 self.assertFalse(parser.buffer_text)
538 self.assertEqual(parser.buffer_size, 1024)
540 parser.Parse(xml2, 0)
543 parser.buffer_text = 1
544 self.assertTrue(parser.buffer_text)
545 self.assertEqual(parser.buffer_size, 1024)
546 parser.Parse(xml3, 1)
559 parser = expat.ParserCreate()
560 parser.CharacterDataHandler = self.counting_handler
561 parser.buffer_size = 1024
562 parser.buffer_text = 1
565 parser.Parse(xml)
571 parser = expat.ParserCreate()
572 parser.CharacterDataHandler = self.counting_handler
573 parser.buffer_text = 1
574 parser.buffer_size = 1024
575 self.assertEqual(parser.buffer_size, 1024)
578 parser.Parse(xml1, 0)
579 parser.buffer_size *= 2
580 self.assertEqual(parser.buffer_size, 2048)
581 parser.Parse(xml2, 1)
587 parser = expat.ParserCreate()
588 parser.CharacterDataHandler = self.counting_handler
589 parser.buffer_text = 1
590 parser.buffer_size = 2048
591 self.assertEqual(parser.buffer_size, 2048)
594 parser.Parse(xml1, 0)
595 parser.buffer_size //= 2
596 self.assertEqual(parser.buffer_size, 1024)
597 parser.Parse(xml2, 1)
603 parser = expat.ParserCreate()
605 parser.Parse(xml, True)
612 parser = expat.ParserCreate()
615 parser.Parse(xml, True)
632 parser = expat.ParserCreate()
633 parser.UseForeignDTD(True)
634 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
635 parser.ExternalEntityRefHandler = resolve_entity
636 parser.Parse("<?xml version='1.0'?><element/>")
642 parser = expat.ParserCreate()
643 parser.UseForeignDTD()
644 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
645 parser.ExternalEntityRefHandler = resolve_entity
646 parser.Parse("<?xml version='1.0'?><element/>")
660 parser = expat.ParserCreate()
661 parser.UseForeignDTD(True)
662 parser.SetParamEntityParsing(expat.XML_PARAM_ENTITY_PARSING_ALWAYS)
663 parser.ExternalEntityRefHandler = resolve_entity
664 parser.Parse(