Re: Whitespace in XML content
Charles Reitzel <[email protected]>
| Newsgroups | gmane.comp.web.html-tidy.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Sarah,
Thanks for writing. A couple things:
1) A patch will definitely help folks evaluate what you are talking about
and make it easier for committers to get your changes into CVS.
2) What is Tidy doing for you if you don't want to pretty print? WF-ness?
3) Leaving that aside, there are a couple things you can do to preserve
whitespace.
Try setting "--wrap 99999". This should prevent the line wrapping, which
is probably the single biggest whitespace change Tidy will do.
Of course, be sure to set --input-xml yes and --output-xml yes.
Be sure to _not_ turn on all the "cleanup" options (off by default):
--clean
--bare
--logical-emphasis
etc.
Here comes the difficult one: --indent. The options are yes, no and
auto. Although it will strip away leading whitespace, you may want to use
"no". "yes" will indent much more often than you probably want (and in no
particular relation to your input). "auto" may be OK, but be sure to set
--indent-spaces to something you like. The amount of whitespace will
change, but it should be in roughly the same places. There is no
"preserve" option, which is what I would recommend (vs. a new option).
Finally, you probably also want --vertical-space no. Here you have yes and
no, where "yes" means Tidy Classic layout and "no" gives you fewer empty
lines. Again, there is no "preserve" option.
hth,
Charlie
At 02:29 PM 1/24/2005 -0800, Sarah Wilkin wrote:
>I recently filed
>http://sourceforge.net/tracker/index.php?
>func=detail&aid=1104229&group_id=27659&atid=390963, which has no
>additional comments yet.
>
>I'm curious what the procedure is for adding new flags to the tidy
>options. For example, I'm interested in a "xml preserve whitespace" or
>a general "preserve whitespace" flag (where the developer would strip
>unwanted whitespace afterwards while walking the tree). Is there
>procedure for nominating header changes, or should I go ahead and make
>the change and hope it gets picked up? The option to treat elements
>with a particular name as block elements doesn't help as I don't know
>what the root element is ahead of time.
>
>Of course the best change would be to evaluate whitespace in xml
>differently than it is in html, purging only the whitespace used as
>spacing between element tags. Since tidy has such a strong html focus
>this would require a much bigger change in the source then merely
>preserving all whitespace.
>
>Thanks,
>--Sarah
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>Tool for open source databases. Create drag-&-drop reports. Save time
>by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>_______________________________________________
>Tidy-develop mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/tidy-develop
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl