additional spaces in complex elements using PrettyFormat

SoTaNeZ <[email protected]> Tue, 15 Jan 2013 09:56:50 +0100
Newsgroups gmane.comp.java.jdom.general
Message-ID <CAJypjWfh_rRKNR0YHvnRUhysv51EsyCphHMkJf5X+bwmhoTEDg@mail.gmail.com>
--===============0749453156==
Content-Type: multipart/alternative; boundary=e89a8ff2447f4ad8b704d34ff185

--e89a8ff2447f4ad8b704d34ff185
Content-Type: text/plain; charset=ISO-8859-1

Hello.

I have some complex elements in which their texts are mixed with some HTML
markup that I treat as XML elements. For example:

------------------------------------------------------
    <paragraph align="justified">
      According to the normalized curve A (LA
      <sub>eq inter</sub>
      ) the values...
    </paragraph >
------------------------------------------------------

The above example is in PrettyFormat.

My intention is to use an XSL to transform this text to HTML, keeping the
HTML representation, so using "xsl:copy-of" I can copy the whole paragraph
as is.
The problem is that the XML elements inserted between the text are
represented in a new line, so the XLT transformation adds both white spaces
before and after these elements in the HTML output:

------------------------------------------------------
According to the normalized curve A (LA eq inter ) the values...
------------------------------------------------------

when the output I want should be:

------------------------------------------------------
According to the normalized curve A (LAeq inter) the values...
------------------------------------------------------

I cannot use the CompactFormat, because I need these XMLs to be readable by
humans.

The problem is solved if I manually place these inner XML elements in the
same line with the rest of the text:

------------------------------------------------------
    <paragraph align="justified">
      According to the normalized curve A (LA<sub>eq inter</sub>) the
values...
    </paragraph >
------------------------------------------------------

Is there a way to tell JDOM to format complex XML elements (those having
text and other elements) this way, or maybe other workarounds?

I prefer to avoid post-processing of the outputted XMLs files...

Thank you very much.

--e89a8ff2447f4ad8b704d34ff185
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello.<div><br><div>I have some complex elements in which their texts are m=
ixed with some HTML markup that I treat as XML elements. For example:</div>=
<div><br></div><div>------------------------------------------------------<=
/div>
<div><div>=A0 =A0 &lt;paragraph align=3D&quot;justified&quot;&gt;</div><div=
>=A0 =A0 =A0 According to the normalized curve A (LA</div><div>=A0 =A0 =A0 =
&lt;sub&gt;eq inter&lt;/sub&gt;</div><div>=A0 =A0 =A0 ) the values...</div>=
<div>=A0 =A0 &lt;/paragraph=A0&gt;</div>
</div><div>------------------------------------------------------</div><div=
><br></div><div>The above example is in PrettyFormat.</div><div><br></div><=
div>My intention is to use an XSL to transform this text to HTML, keeping t=
he HTML representation, so using &quot;xsl:copy-of&quot; I can copy the who=
le paragraph as is.</div>
<div>The problem is that the XML elements inserted between the text are rep=
resented in a new line, so the XLT transformation adds both white spaces be=
fore and after these elements in the HTML output:</div><div><br></div><div>
------------------------------------------------------</div><div><div>Accor=
ding to the normalized curve A (LA=A0<font size=3D"1">eq inter</font>=A0) t=
he values...</div></div><div>----------------------------------------------=
--------</div>
<div><br></div><div>when the output I want should be:</div><div><br></div><=
div>------------------------------------------------------</div><div>Accord=
ing to the normalized curve A (LA<font size=3D"1">eq inter</font>) the valu=
es...</div>
<div>------------------------------------------------------</div><div><br><=
/div><div>I cannot use the CompactFormat, because I need these XMLs to be r=
eadable by humans.</div><div><br></div><div>The problem is solved if I manu=
ally place these inner XML elements in the same line with the rest of the t=
ext:</div>
<div><br></div><div>------------------------------------------------------<=
/div><div><div>=A0 =A0 &lt;paragraph align=3D&quot;justified&quot;&gt;</div=
><div>=A0 =A0 =A0 According to the normalized curve A (LA&lt;sub&gt;eq inte=
r&lt;/sub&gt;) the values...</div>
<div>=A0 =A0 &lt;/paragraph=A0&gt;</div></div><div>------------------------=
------------------------------</div><div><br></div><div>Is there a way to t=
ell JDOM to format complex XML elements (those having text and other elemen=
ts) this way, or maybe other workarounds?</div>
<div><br></div><div>I prefer to avoid post-processing of the outputted XMLs=
 files...</div><div><br></div><div>Thank you very much.</div></div><div><br=
></div>

--e89a8ff2447f4ad8b704d34ff185--

--===============0749453156==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
--===============0749453156==--