• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

serialization problem with JDOM

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Danger, 10,000 volts, very electic .... tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic