• 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

serialization problem with JDOM

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I like JDOM a lot because of its an easy api.
But i have a real Problem when i want to serialize it with JDOM

I want to use the following method(taken from the JDOM Api
public void output(Document doc,
java.io.Writer writer)
throws java.io.IOException
This will print the Document to the given Writer.

The following is my Source Code
SAXBuilder b = new SAXBuilder();
// Create the document
Document doc = b.build(new File(xmlsourcepath));
//get the root -Element
Element rootElement = doc.getRootElement();
serialize(doc);
public void serialize(Document doc) throws Exception {
XMLOutputter outputter = new XMLOutputter();
//outputter.setIndentSize(2);
FileWriter writer = new FileWriter(xmlsourcepath);
outputter.ouput(doc,(java.io.Writer)writer);
}
When i want to compile withe the JBuilder i get the following errormessage
"Main.java": Error #: 300 : method ouput(org.jdom.Document, java.io.Writer) not found in class org.jdom.output.XMLOutputter at line 78, column 17
How can this be ? I als took a looks a the sourcecode of Jdom but i couldnt find any mistake
public void output(Document doc, Writer writer)

i could use the DomOutputter to make a org.w3c.dom.Document and then i could serialize it with Xerces but this is overhead..
has any of you got the same probelm.How did you fixed it ?
Thx,
Holger
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!