mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	 02505e4850
			
		
	
	
		02505e4850
		
	
	
	
	
		
			
			The main incompatibility is that the error reporting method is now called as parser.syntax_error(msg) instead of parser.syntax_error(lineno, msg) This new version also has some code to deal with the <?xml?> and <!DOCTYPE> tags at the start of an XML document. The documentation has been updated, and a small test module has been created.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			523 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			523 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| '''Test module to thest the xmllib module.
 | |
|    Sjoerd Mullender
 | |
| '''
 | |
| 
 | |
| from test_support import verbose
 | |
| 
 | |
| testdoc = """\
 | |
| <?xml version="1.0" encoding="UTF-8" standalone='yes' ?>
 | |
| <!-- comments aren't allowed before the <?xml?> tag,
 | |
|      but they are allowed before the <!DOCTYPE> tag -->
 | |
| <!DOCTYPE greeting [
 | |
|   <!ELEMENT greeting (#PCDATA)>
 | |
| ]>
 | |
| <greeting>Hello, world!</greeting>
 | |
| """
 | |
| 
 | |
| import xmllib
 | |
| if verbose:
 | |
| 	parser = xmllib.TestXMLParser()
 | |
| else:
 | |
| 	parser = xmllib.XMLParser()
 | |
| 
 | |
| for c in testdoc:
 | |
| 	parser.feed(c)
 | |
| parser.close()
 |