Tres Seaver wrote:
Ian Bicking wrote:
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.
Right. What else should the line number be? It's the line in which the element was found by the parser. If you mix element from different document, this information becomes meaningless.
Logically, wouldn't the xincluded node have its "own" document reference, with correct filename / URL, since it is just "borrowed" into the including document?
No. It will refer to the document that contains it (after the inclusion).
I don't know if lxml's / ETree's semantics support such a notion, however.
No. All elements in a document should always refer to this document. Stefan