I am developing xml editor using jsp and servlet. In this case i am using DOM parser. using that i getting all the element, text, xpath form xml file with help of DTD.

Upto this it will be working, and it save back into xml file.
While save into xml file, <!DOCTYPE construct SYSTEM "c:/xmleditor/dtd/xConStruct.dtd"> this line deleted, This is my problem.please help me.

thank in advance.


you have to include this line while you are saving the xml file...

Transformer transformer = TransformerFactory.newInstance().newTransformer();
       transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "your DTD  file name");
       transformer.transform(source, result);

Hope it will help you..

It is working..

I have another problem in XML editor using java(jsp,servlet),
How to edit the following xml file without losing elements.

<book id="b1">
 <bookbegin id="bb1">
    <para id="p1">This is<b>first</b>line</para>
    <para id="p2">This is<b>second</b>line</para>
    <para id="p3">This is<b>third</b>line</para>

I try to edit the above xml file using dtd using jsp,servlet. but while i read the textvalue from xml, it return only first,second,third.How to read the 'This is' and 'line '. Then how to store back to the xml file using xpath.

thank in advance.