Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F80218A5D for ; Tue, 8 Mar 2016 18:22:38 +0000 (UTC) Received: (qmail 47889 invoked by uid 500); 8 Mar 2016 18:22:37 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 47858 invoked by uid 500); 8 Mar 2016 18:22:37 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 47848 invoked by uid 99); 8 Mar 2016 18:22:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2016 18:22:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 37C5718060A for ; Tue, 8 Mar 2016 18:22:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.997 X-Spam-Level: * X-Spam-Status: No, score=1.997 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 7lofQcTS_rEy for ; Tue, 8 Mar 2016 18:22:35 +0000 (UTC) Received: from mail1.bemta12.messagelabs.com (mail1.bemta12.messagelabs.com [216.82.251.10]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 22B945FB56 for ; Tue, 8 Mar 2016 18:22:35 +0000 (UTC) Received: from [216.82.251.38] by server-10.bemta-12.messagelabs.com id 89/29-02991-A681FD65; Tue, 08 Mar 2016 18:22:34 +0000 X-Env-Sender: Torsten.Reinhard.bp@nttdata.com X-Msg-Ref: server-8.tower-163.messagelabs.com!1457461352!36407972!1 X-Originating-IP: [141.77.150.12] X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=nttdata.com,-,- X-VirusChecked: Checked Received: (qmail 27520 invoked from network); 8 Mar 2016 18:22:33 -0000 Received: from mail1.nttdata-emea.com (HELO mail1.nttdata-emea.com) (141.77.150.12) by server-8.tower-163.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 8 Mar 2016 18:22:33 -0000 Received: from muc-excaht-01.de.softlab.net (unknown [141.77.2.48]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail1.nttdata-emea.com (Postfix) with ESMTPS id 3E1B3C20054 for ; Tue, 8 Mar 2016 19:22:32 +0100 (CET) Received: from MUC-EXMBX-02.de.softlab.net ([141.77.2.42]) by MUC-EXCAHT-02.de.softlab.net ([141.77.2.48]) with mapi id 14.03.0248.002; Tue, 8 Mar 2016 19:22:32 +0100 From: Reinhard Torsten To: "users@groovy.apache.org" Subject: XmlTemplateEngine - output format Thread-Topic: XmlTemplateEngine - output format Thread-Index: AdF5Z3pONiErlVC2R2aWwvhN+5xbNg== Date: Tue, 8 Mar 2016 18:22:31 +0000 Message-ID: <873879EB34A608429D74307CB672E477D9342E@muc-exmbx-02.de.softlab.net> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.77.229.152] Content-Type: multipart/alternative; boundary="_000_873879EB34A608429D74307CB672E477D9342Emucexmbx02desoftl_" MIME-Version: 1.0 --_000_873879EB34A608429D74307CB672E477D9342Emucexmbx02desoftl_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I=B4m using the XmlTemplateEngine to generate some config files using the = following code: XmlTemplateEngine engine =3D new XmlTemplateEngine() Template template =3D engine.createTemplate( getTemplateFile() ) Writable output =3D template.make( getConfig() ) StringWriter writer =3D new StringWriter() output.writeTo(writer) println writer.toString() The generated output looks like: ... 20150903 ... But it should=B4nt have whitespaces, so this is what I want: 20150903 My current workaround is to parse the result again and re-format it using xmlNodePrinter =3D new XmlNodePrinter() xmlNodePrinter.with { preserveWhitespace =3D true expandEmptyElements =3D true quote =3D "'" // Use single quote for attributes } xmlNodePrinter.print( new XmlParser().parseText(writer.toString() )) =F0 How can I easily adjust the output format of the generated *.xml with= out re-reading it? Thanx for any help Torsten ______________________________________________________________________ Disclaimer: This email and any attachments are sent in strictest confidenc= e for the sole use of the addressee and may contain legally privileged, confidential, and proprietary data. If you are not the intended recipient,= please advise the sender by replying promptly to this email and then delet= e and destroy this email and any attachments without any further use, copyin= g or forwarding. --_000_873879EB34A608429D74307CB672E477D9342Emucexmbx02desoftl_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi,

 

I=B4m using the XmlTemplateEng= ine to generate some config files using the following code:

 

XmlTemplateEng= ine engine =3D new XmlTemplateEngine()<= /span>

Template templ= ate =3D engine.createTemplate( getTemplateFile() )

=

 

Writable outpu= t =3D template.make( getConfig() )

 

StringWriter w= riter =3D new StringWriter()=

output.writeTo= (writer)

println writer.toString()

 

The generated = output looks like:

  <configversion><= /span>

    20150903

  </configversion>=

 

But it should=B4nt have wh= itespaces, so this is what I want:

 

  <con= figversion>20150903</configversion>

 

 

My current workaround is t= o parse the result again and re-format it using

 

xmlNodePrinter= =3D new XmlNodePrinter()

xmlNodePrinter= .with {

  preserveWhitespace =3D true

  expandEmptyElements =3D true

  quote =3D "'" // Use single quote for attributes

=

}=

xmlNodePrinter= .print( new XmlParser().parseText(writer.toSt= ring() ))

 

=F0  How can I easily adjust the output format of the= generated *.xml without re-reading it?

 

Thanx for any help

 

Torsten<= /p>

 

 

 

 

 

 


______________________________________________________________________
= Disclaimer: This email and any attachments are sent in strictest confidenc= e
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,=
please advise the sender by replying promptly to this email and then delet= e
and destroy this email and any attachments without any further use, copyin= g
or forwarding.
--_000_873879EB34A608429D74307CB672E477D9342Emucexmbx02desoftl_--