Project

General

Profile

« Previous | Next » 

Revision 1763

xml_parse.py: parse_next(): Strip control characters from input stream because they mess up the parser

View differences:

lib/xml_parse.py
6 6

  
7 7
import exc
8 8
import streams
9
import strings
9 10

  
10 11
def parse_str(str_): return minidom.parseString(str_).documentElement
11 12

  
......
39 40
    '''Parses the next document in a consecutive sequence of XML documents.
40 41
    @return The next document's root, or None if no more documents available
41 42
    '''
42
    try: return minidom.parse(ConsecXmlInputStream(stream)).documentElement
43
    try: return minidom.parse(streams.FilterStream(strings.strip_ctrl,
44
        ConsecXmlInputStream(stream))).documentElement
43 45
    except expat.ExpatError, e:
44 46
        # Save in case another exception raised, overwriting sys.exc_info()
45 47
        exc.add_traceback(e)

Also available in: Unified diff