|
Ben,
I should have included an example. Here is one that
shows how simple JDom really is:
Element e = new Element("root-element");
Document d = new Document(e);
(you now have enough to create the file! but add
some content)
Element e2 = new Element("some-element");
e2.addAttribute(new Attribute("some-attribute", "value"));
e.addContent(e2);
(Now write it out)
try {
XMLOutputter o = new XMLOutputter("/myfile.xml");
o.output(d);
}
catch (Exception e) {
}
I probably missed something, and may have used some
depricated code, but that is pretty close to what is
required. Doing this with Xerces, or Crimson would
require creating a factory to build the document
and a lot of other stuff that makes it more difficult than
necessary.
David Morris
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.