[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-19 Thread Schimon Jehudah via lxml - The Python XML Toolkit
Adrian. Good afternoon. I did not realize it. I, now, know. Thank you, Schimon On Thu, 19 Jun 2025 06:19:01 +0100 Adrian Bool wrote: > Hi Schimon, > > You've been using Python's built-in ElementTree implementation > (xml.etree.ElementTree). > > This mailing list, and Xavier's guidance, is

[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-19 Thread Schimon Jehudah via lxml - The Python XML Toolkit
Xavier. Good afternoon. After realizing that I had to import from lxml, it wroks. https://git.xmpp-it.net/sch/publish-happy/commit/87d76d2585c58183752bfb0b80bb34881bef2256 I have failed with the namespaces, and I shall try again. Thank you, Schimon On Mon, 16 Jun 2025 08:04:01 +0200 Xavier Mor

[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-18 Thread Adrian Bool
Hi Schimon, You've been using Python's built-in ElementTree implementation (xml.etree.ElementTree). This mailing list, and Xavier's guidance, is for the "lxml" package . So, ensure you've got lxml available within your project (e.g. "pip install lxml") and then import with:

[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-18 Thread Schimon Jehudah via lxml - The Python XML Toolkit
Xavier. Good evening. I beg your pardon, Please kindly tell me from where did you import ET, as I receive this error after ecevuting ET.tostring(ET.ElementTree(e_feed)). AttributeError: 'ElementTree' object has no attribute 'tag' Regards, Schimon On Mon, 16 Jun 2025 08:04:01 +0200 Xavier Morel

[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-15 Thread Xavier Morel via lxml - The Python XML Toolkit
On 14/06/25 20:33, Schimon Jehudah via lxml - The Python XML Toolkit wrote:> Would it be sensible to allow a negative value: e_feed.insert(-1, xslt_reference) If you test this, you will find out that inserting at negative indexes is already a valid operation: `insert(-x, el)` inserts at index

[lxml] Re: ElementTree function insert() to accept negative value.

2025-06-14 Thread Schimon Jehudah via lxml - The Python XML Toolkit
Greetings. Alternatively, it would probably be good to add a new keyword argument to function write() to xml.etree.ElementTree. def write(self, file_or_filename, encoding=None, xml_declaration=None, default_namespace=None, method=None, *