[xml] indentation (again!)
- From: Bruce Miller <bruce miller nist gov>
- To: <xml gnome org>
- Subject: [xml] indentation (again!)
- Date: Sat, 25 Jul 2015 08:12:39 -0400
Hi all;
I find unindented XML to be virtually impossible
to debug, but...
Frankly, I'm impressed at how good the built-in heuristic
for formatting works (apparently the rule is: once it sees
mixed content, it turns off indentation below that level).
Of course, it isn't "correct" and is occasionally giving me
really messy problems.
In principle, and perhaps naively, it seems the Correct rule
is rather simple, provided you have access to the DTD/Schema/whatever.
Namely, if an element allows mixed content, do not add whitespace.
(and you CAN apply indentation on descendants that do NOT allow mixed
content).
Is there some switch or method that I'm overlooking to
achieve this effect? Is this likely to be relatively easy
to implement? (I've managed to avoid learning libxml2's C API,
as I use it via Perl's XML::LibXML.)
I'd hate to have to give up indentation or write
my own serializer....
Thanks;
bruce
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]