Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: Line wrapping Date: Wed, 18 Jan 2012 13:38:54 -0500 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 18 Jan 2012 18:30:54 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="qwFw1g9RsQ6TkML5yezG9A"; logging-data="27122"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iesApynsvg+HXgrYF71qJpVQc1u5I6Rw=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11 In-Reply-To: Cancel-Lock: sha1:0Ry0w86BZ5R98hpUCGnU9VxGuRo= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11471 On 01/18/2012 11:04 AM, Mark wrote: > On Wed, 18 Jan 2012 09:51:12 -0500, Jeff Higgins > wrote: > >> On 01/18/2012 08:20 AM, Mark wrote: >>> I need to write some code to wrap lines for printing. The data to >>> print is XML. I have not found that the classes that I have found >>> allow you to choose which characters are used as line breaks. >>> For example org.apache.xml.serialize.OutputFormat does not do this. >> >> This may be of interest. >> > > I've tried this code but it presents the whole XML document all in one > line. I am trying to get some nicely formatted output for sending to > a printer. The code snippet I posted nearly does this, except for the > line wrapping. George Hawkins in a comment on the second answer in this question provided the link above. He also suggests: writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); I guess I should have pointed to this article to start but I don't know how to point to individual posts or comments.