[lxml-dev] finding the line number of a parsed element

Tres Seaver tseaver at palladion.com
Sun Apr 15 20:56:58 CEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Bicking wrote:
> Stefan Behnel wrote:
>> Hi Ian,
>>
>> Ian Bicking wrote:
>>>> Stefan Behnel wrote:
>>>>> There is no API for it, but internally, we have this information for
>>>>> parsed
>>>>> trees, at least the line number - note that exceptions contain the
>>>>> line number
>>> Is there a file or resource name in there somewhere too?  This would be
>>> nice to have if, say, you were using xinclude to combine elements from
>>> different sources.
>> No, that's only stored at a per-document level (which makes sense IMHO).
> 
> What would you do then if you create a document with multiple sources? 
> E.g., if you use xinclude to include elements from different sources 
> into a single document.  The line numbers will be nonsense at that 
> point, and there's no clear place to keep track of the real source.

Logically, wouldn't the xincluded node have its "own" document
reference, with correct filename / URL, since it is just "borrowed" into
the including document?  I don't know if lxml's / ETree's semantics
support such a notion, however.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGInV6+gerLs4ltQ4RAltQAKDa6LHNYl6L/ZhDcv4wsJUxCyVSmgCgjDRV
7Bg0RmDMvzBgBl8vIps0Xxc=
=Tyc3
-----END PGP SIGNATURE-----



More information about the lxml-dev mailing list