[lxml-dev] Setting URL from lxml.html.fromstring, etc

Stefan Behnel stefan_ml at behnel.de
Mon Feb 25 17:19:39 CET 2008


Hi,

Ian Bicking wrote:
> Probably not a problem, but it doesn't seem that much like a problem to
> make it writable too.  Especially since the document itself is writable.
>  Once you've edited the document, it's not *the* document at that URL
> anyway.  Maybe you get a page, edit it, and serve it at a new location.
>  Deliverance does this by getting the theme page, then injecting the
> content into that page -- but the theme page is the originally-parsed
> object, though it will be served at a different location.  I'd like to
> be able to fix up that data.  And I'm not sure how I'd make a copy of a
> document with a new URL, if the URL/document link is immutable.  (Right
> now I'm mostly ignoring the URL, but it would be nice if I could
> actually trust it.)

Setting the document URL works on the current trunk.

I also added a "base" property to Elements that is based on the xml:base
attribute (or the appropriate fallback to the document URL).

Stefan




More information about the lxml-dev mailing list