Logo Search packages:      
Sourcecode: zope-parsedxml version File versions

def ParsedXML::DOM::ExpatBuilder::ExpatBuilder::parseFile (   self,
  file 
) [inherited]

Parse a document from a file object, returning the document
node.

Reimplemented in ParsedXML::DOM::ExpatBuilder::FragmentBuilder, and ParsedXML::DOM::ExpatBuilder::InternalSubsetExtractor.

Definition at line 215 of file ExpatBuilder.py.

00215                              :
        """Parse a document from a file object, returning the document
        node."""
        parser = self.getParser()
        first_buffer = 1
        strip_newline = 0
        while 1:
            buffer = file.read(16*1024)
            if not buffer:
                break
            if strip_newline:
                if buffer[0] == "\n":
                    buffer = buffer[1:]
                strip_newline = 0
            if buffer and buffer[-1] == "\r":
                strip_newline = 1
            buffer = _normalize_lines(buffer)
            parser.Parse(buffer, 0)
            if first_buffer and self.document:
                if self.document.doctype:
                    self._setup_subset(buffer)
                first_buffer = 0
        parser.Parse("", 1)
        doc = self.document
        self.reset()
        self._parser = None
        return doc

    def parseString(self, string):


Generated by  Doxygen 1.6.0   Back to index