954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

XML Editor in java

Hi,
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, this line deleted, This is my problem.please help me.

thank in advance.

manikandan_dani
Newbie Poster
17 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

Hi!

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..

indu_ss4
Newbie Poster
22 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

Thanks!
It is working..

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

<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>
 </bookbegin>
</book>

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.

manikandan_dani
Newbie Poster
17 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You