[jdom-interest] code sample for the XMLOutputter question.
Ing. Terenzio Berni
tberni at dianoema.it
Fri Jan 16 09:27:11 PST 2004
1) I have configured the SAXBuilder with this instructions:
SAXBuilder saxBuilder = new SAXBuilder(true);
saxBuilder.setFeature("http://apache.org/xml/features/validation/schema",
true);
saxBuilder.setProperty("http://apache.org/xml/properties/schema/external-sch
emaLocation","urn:hl7-org:v2xml file:///C:/xsd/messages.xsd");
2) I validate the xml and create a Document this way:
InputStream inputstream = new FileInputStream("C:/test_files/ADT_A01.xml");
Document document = saxBuilder.build(inputstream);
3) and I output the file like this:
XMLOutputter output = new XMLOutputter(" ");
output.output(cloneddocument, new
FileOutputStream("C:/test_files/ADT_A01_modified.xml"));
but I don't know how to strip out all the datas gathered during the
validation from the XSD. I've searched some Xerces properties but I didn't
find anything that worked...
Regard, Terenzio
More information about the jdom-interest
mailing list