Re: can you tell me how to use stdin?

Uche Ogbuji <[email protected]>
Newsgroups gmane.comp.python.xml
Organization Fourthought, Inc.
Message-ID <1118676548.26958.33.camel@borgia>
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

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.