Re: [xml] indentation (again!)
- From: Bruce Miller <bruce miller nist gov>
- To: <veillard redhat com>
- Cc: xml gnome org
- Subject: Re: [xml] indentation (again!)
- Date: Wed, 21 Oct 2015 08:26:21 -0400
On 10/16/2015 05:34 AM, Daniel Veillard wrote:
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?
no, indeed this would make sense ... assuming you have a schemas, etc...
but when you serialize a document while the DTD *might* be available
you can't really find out he RNG or XSD associated (or trust them, download
them, etc....) it open a can of worm TBH.
Yup, I understand; I wasn't really suggest that you introduce
this complication at this stage! Just checking whether it was already
hidden somewhere. In my case, I'm guaranteed to have the schema
available for such information.
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....
have you looked at xmllint --pretty 2
it does pretty printing but without adding (or removing) any significant
character, it uses only the non-significant spaces from within markup
which are discarded at parsing time.
I know it's not what you asked for but might still be useful :-)
Not quite what I needed, since I'm doing document surgery all the
time. I went ahead & implemented my own serializer, but it wasn't
really all that bad, since I could still rely on libxml's lower
level string munging :> And surprisingly enough, no significant
performance penalty.
And it helped me simplify lots of bad heuristics! :>
Yay!
Thanks for the response;
bruce
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]