[XML-SIG] python xml parser

Dave Kuhlman dkuhlman at cutter.rexx.com
Thu Mar 4 11:26:29 EST 2004


On Tue, Mar 02, 2004 at 04:21:57PM -0500, J. Xu wrote:
> How can I pass stdout of processes, or output stream of network channels 
> (like ssh) to a python xml parser (either through DOM or SAX) so that 
> xml can be used as the communication tool among different components of 
> the software? I think the standard python xml reader expects a file-like 
>   object or string as the input, but not sure if it can take a stream. 
> Any suggestions are highly appreciated.

The minidom parser in the Python standard library will take a file
name or a file object.  From
http://www.python.org/doc/current/lib/module-xml.dom.minidom.html:

    parse(filename_or_file, parser)
        Return a Document from the given input. filename_or_file
        may be either a file name, or a file-like object. parser,
        if given, must be a SAX2 parser object. This function will
        change the document handler of the parser and activate
        namespace support; other parser configuration (like setting
        an entity resolver) must have been done in advance.

Dave

-- 
Dave Kuhlman
dkuhlman at rexx.com
http://www.rexx.com/~dkuhlman



More information about the XML-SIG mailing list