Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Question about Serializer

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Arjan Huijzer <huijzer AT gmail.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Question about Serializer
  • Date: Thu, 11 Nov 2004 16:29:23 +0100

Hello,

I am trying to read a Log4j configuration file, change some elements
and then write it back. But somehow, the entire DTD gets included in
the output file:

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" [
....
....
....
]>


However, I just want it to write the declaration like this:

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

Does anyone know how to accomplisg this?
Thanks in advance for any help!

Arjan Huijzer
The Netherlands

=======================================
THE JAVA CODE
=======================================

import java.io.*;
import nu.xom.*;

public class LogParser {

private final static String IN_FILE = "LoggingConfiguration.xml";
private final static String OUT_FILE = "LoggingConfiguration_new.xml";

/**
* Starting point for application.
*
* @param args arguments passed to the application.
*/
public static void main (String[] args) {
try {
Builder parser = new Builder();
Document doc = parser.build(IN_FILE);

FileOutputStream out = new FileOutputStream(OUT_FILE);
Serializer s = new Serializer(out);
s.write(doc);

} catch (ParsingException pe) {
pe.printStackTrace();
} catch (IOException ie) {
ie.printStackTrace();
}
}
}




Archive powered by MHonArc 2.6.24.

Top of Page