• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Generating XML

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using DOM Transform to generate XML. Works OK, but attributes appear in a hard to read end-to-end block. Anyone know if there is a way to get them neatly indented on individual lines?
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Xerces

using Crimson
Using the Sun's Crimson you can cast the w3c document to type of XmlDocument and then use the write method.

This method works except for a small shortcoming - every save creates a carriage return character behind every closing tag. As I open modify and then save the same file these characters are adding up quickly.

Using Transformer Package that is included with JAXP1.1

This method works great except for one major flaw. If your document had a DOCTYPE, when you load your document, add some nodes etc.. and then save, you will notice the DOCTYPE declaration missing!!.
HTH
------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!