PrettyPrint indent size is alway 2 spaces

Bug #1727305 reported by Rade Martinović
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Won't Fix
Undecided
Unassigned

Bug Description

I notified this using https://github.com/eerohele/exalt which in turn uses lxml. When PrettyPrinting an XML indent is always 2 spaces. Is there a way to make this configurable?

Revision history for this message
scoder (scoder) wrote :

Not easily. libxml2 does the pretty printing, and it does not have an option for changing the indentation. Supporting a different "indent" (string) option would require either a) adding that option to libxml2, or b) reimplementing the entire serialiser in lxml. I'd rather not allow the latter, and the first would mean that the feature would not always be available for users.

scoder (scoder)
Changed in lxml:
status: New → Won't Fix
Revision history for this message
Rade Martinović (rocky-mm) wrote :

It saddens me to see that this is not possible to resolve in lxml. To me personally indent of 2 spaces feels unnatural. Maybe I can think of a workaround in exalt project to he a the indentation according to my preference.

Thanks for the reply.

Revision history for this message
scoder (scoder) wrote :

Well, you can use this if you can afford to modify the tree before serialisation:
http://effbot.org/zone/element-lib.htm#prettyprint

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.