K
Kimos
Hi, all.
I'm creating 'struts-config.xml' generator with dom4j.
The process is..
1. Read 'struts-config.xml' and parse with dom4j.
2. Add some elements to that.
3. Write it to 'struts-config.xml'.
I've tested like followings.
SAXReader reader = new SAXReader();
reader.setStripWhitespaceText(false);
reader.setIgnoreComments(false);
Document doc = reader.read(new File("struts-config.xml"));
System.out.println(doc.asXML());
When 'struts-config.xml' has no DTD declaration,
This code works very well.
All white spaces are preserved and xml is exactly same to original.
But when 'struts-config.xml' has DTD declaration,
the white spaces are removed.
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
How can I solve this problem?
I use JDK1.4.2 and dom4j 1.4.
Thanks in advance.
I'm creating 'struts-config.xml' generator with dom4j.
The process is..
1. Read 'struts-config.xml' and parse with dom4j.
2. Add some elements to that.
3. Write it to 'struts-config.xml'.
I've tested like followings.
SAXReader reader = new SAXReader();
reader.setStripWhitespaceText(false);
reader.setIgnoreComments(false);
Document doc = reader.read(new File("struts-config.xml"));
System.out.println(doc.asXML());
When 'struts-config.xml' has no DTD declaration,
This code works very well.
All white spaces are preserved and xml is exactly same to original.
But when 'struts-config.xml' has DTD declaration,
the white spaces are removed.
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
How can I solve this problem?
I use JDK1.4.2 and dom4j 1.4.
Thanks in advance.