[Lxml-checkins] r51170 - in lxml/trunk: . doc

scoder at codespeak.net scoder at codespeak.net
Fri Feb 1 12:34:22 CET 2008


Author: scoder
Date: Fri Feb  1 12:34:22 2008
New Revision: 51170

Modified:
   lxml/trunk/   (props changed)
   lxml/trunk/doc/tutorial.txt
Log:
 r3375 at delle:  sbehnel | 2008-02-01 11:40:10 +0100
 tutorial update: mention parsing from URLs


Modified: lxml/trunk/doc/tutorial.txt
==============================================================================
--- lxml/trunk/doc/tutorial.txt	(original)
+++ lxml/trunk/doc/tutorial.txt	Fri Feb  1 12:34:22 2008
@@ -546,11 +546,12 @@
 Parsing from strings and files
 ==============================
 
-``lxml.etree`` supports parsing XML in a number of ways and from all important
-sources, namely strings, files and file-like objects.  The main parse
-functions are ``fromstring()`` and ``parse()``, both called with the source as
-first argument.  By default, they use the standard parser, but you can always
-pass a different parser as second argument.
+``lxml.etree`` supports parsing XML in a number of ways and from all
+important sources, namely strings, files, URLs (http/ftp) and
+file-like objects.  The main parse functions are ``fromstring()`` and
+``parse()``, both called with the source as first argument.  By
+default, they use the standard parser, but you can always pass a
+different parser as second argument.
 
 
 The fromstring() function
@@ -601,6 +602,20 @@
     >>> print etree.tostring(root)
     <root>data</root>
 
+The ``parse()`` function supports any of the following sources:
+
+* an open file object
+
+* a file-like object that has a ``.read(byte_count)`` method returning
+  a byte string on each call
+
+* a filename string
+
+* an HTTP or FTP URL string
+
+Note that passing a filename or URL is usually faster than passing an
+open file.
+
 
 Parser objects
 --------------


More information about the lxml-checkins mailing list