[XML-SIG] python xml parser

Robert Barta rho at bigpond.net.au
Fri Mar 5 15:24:46 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?

A slightly odd question here, I'd think.

To 'pass stdout' you simply use the shell 'piping'

  myprocess_whatever | python mypython

If you have created a tunnel with SSH then that will have established
a local port to connect to. You simply let your Python script connect
to that port. It does not have to know that that is SSH tunnel anyway.

> 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. 

Not sure about the 'standard python xml reader', but pretty much
everyone allows to parse from a stream, file or a string.

Reading the docs helps.


More information about the XML-SIG mailing list