Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Small bug in Serializer relating to indentation and preserving whitespace

xom-interest AT

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Asgeir Frimannsson" <asgeirf AT>
  • To: xom-interest AT
  • Subject: [XOM-interest] Small bug in Serializer relating to indentation and preserving whitespace
  • Date: Sat, 20 Oct 2007 16:00:43 +1000


I'm experimenting with writing a streaming serializer for my XOM-based data
model, and noticed what seem to be a small bug in nu.xom.Serializer.

The following snipplet reproduces the bug:

Serializer serializer = new Serializer(System.out);
Element root = new Element("root");
Document doc = new Document(root);
Attribute spaceAtt = new Attribute(
root.appendChild(new Element("child1"));
// these 4 space characters should be preserved:
root.appendChild(new Text(" "));
root.appendChild(new Element("child2"));

Expected output:
<?xml version="1.0" encoding="UTF-8"?>
<root xml:space="preserve"><child1/> <child2/></root>

Actual output:
<?xml version="1.0" encoding="UTF-8"?>
<root xml:space="preserve"><child1/><child2/></root>

I have attached a simple proposed patch for this bug...


Asgeir Frimannsson
PhD Candidate
School of Software Engineering and Data Communications
Queensland University of Technology
126 Margaret Street, Level 3
Brisbane QLD 4001, Australia

Phone: (+61) 7 3138 9332 Mob: (+61) 405 412 696
Email: asgeirf AT

Archive powered by MHonArc 2.6.24.

Top of Page