[XML-SIG] can you tell me how to use stdin?

Uche Ogbuji Uche.Ogbuji at fourthought.com
Mon Jun 13 17:29:08 CEST 2005


On Sun, 2005-06-12 at 13:37 +0800, ÒÊÃÉɽÈË wrote:
> In the PyXml module,there is an example like this:
> 
>      from xml.dom.ext.reader.Sax2 import FromXmlStream
>      doc = FromXmlStream(sys.stdin)
> >From the example the argument of FromXmlStream is sys.stdin,
> but now i have a xml file namede "test.xml",how can i redirect the
> stdin to the file?
> 
> For a long time,i have been confused about stdin , can you give me
> an example ? Thanks a bounch.

Use xml.dom.minidom.  Do not use xml.dom.ext.reader.*.

dom = minidom.parse("test.xml")


-- 
Uche Ogbuji                               Fourthought, Inc.
http://uche.ogbuji.net                    http://fourthought.com
http://copia.ogbuji.net                   http://4Suite.org
Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html
XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html
Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/
Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html



More information about the XML-SIG mailing list