Hi Gilles,

> On 12 May 2022, at 13:08, Gilles <codecompl...@free.fr> wrote:
> 1. Is there a way to tell lxml _not_ to add <html><body> and </body></html> 
> when inserting the header right after <body>?

You're not loading the header data with the HTMLParser are you??  It is the 
HTMLParser that adds <head> etc.  Just parse the content without a specific 
parser specified...

> 2. I need to add a header and a footer in each HTML file, and the </div> is 
> actually located in the footer: Will lxml complain if it's missing in the 
> header, ie. it's malformed XML/HTML (per your comment above)?

If you're loading and parsing the header and footer as separate enties; then 
no, I wouldn't expect that to be possible.  Just keep header and footer in 
their own parent Elements and if necessary have some over-all <div> defined 
within "wrapper"...

Kind regards

ad

_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to