[jdom-interest] Single space in element content

Jan Moravec/SYD/CEtv JanMoravec at austar.com.au
Wed Jun 5 00:51:21 PDT 2002


I have been having problems with setting the content of an element to
contain a single or multiple spaces e.g <Artist> </Artist>. As long as the
element contains at least a single non whitespace char, everything is OK
and spaces are correctly inserted into the element content and preserved
when read back.

This is a real word example of the XML doc I generate:

<?xml version="1.0" encoding="UTF-8"?>
<xform xmlns:xf="http://www.austar.com.au/2001/XFormica" xmlns:xa
="http://www.austar.com.au/2001/XFormica-Adjunct" ref="XFormica">
  <submitInfo method="post" />
  <hidden ref="_xf_root" value="/root/ByDemand/RequestedList/Item[4]" />
  <hidden ref="_xf_previous_root" value="/root" />
  <hidden ref="_xf_action" value="" />
  <hidden ref="_xf_action_node" value="" />
  <hidden ref="_xf_request_id" value="4" />
  <input ref="/root/ByDemand/RequestedList/Item[4]/Artist" xf:required
="true" xf:minOccurs="1" xf:maxOccurs="1" xf:label="Artist" xf:type
    <value />
  <input ref="/root/ByDemand/RequestedList/Item[4]/Song" xf:required="true"
xf:minOccurs="1" xf:maxOccurs="1" xf:label="Song" xf:type="string">
    <value>MOST REQUESTED THIS WEEK:</value>
    <button actionID="submit">
    <button actionID="cancel">

Highlighted is the element that I am trying to put spaces into. <value />
should be <value> </value>

In DOM inserting spaces into an element content seems to work without

I am using JDOM-beta8.

I tried both
input.addContent( new Element("value").addContent(new Text(" ")) )


input.addContent( new Element("value").setText(" ") )

but with the same result.

Thanks for any hints.


This email and any files transmitted with it, are confidential and is intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error, please notify the system manager.

This footnote also confirms that this email message has been scanned by AUSTAR Communications content  and virus scanning applications
for the presence of computer viruses.

More information about the jdom-interest mailing list