aspose file tools*
The moose likes XML and Related Technologies and the fly likes How to Edit xml(rendered as html) file and again save it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to Edit xml(rendered as html) file and again save it" Watch "How to Edit xml(rendered as html) file and again save it" New topic
Author

How to Edit xml(rendered as html) file and again save it

Sandeep. Oza
Ranch Hand

Joined: Feb 04, 2002
Posts: 66
Hi All,
In my java-jsp application, I am displaying xml file on the browser as html rendering using CSS.
Now I want to make change in data(content) of few predefined tags(fields).
And again save this xml(html to xml) file.
So how to make this editable...??? How to transform html to xml and save...??
Pl. help.
Thanks in advance.
Sandeep Oza


Yes, Everything Is Possible
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could put the XML into an HTML textarea, let the user edit the XML there and then submit the form/change.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sandeep. Oza
Ranch Hand

Joined: Feb 04, 2002
Posts: 66
Thank you Lasse.
My xml file is very large having lot of tags with attributes... I want to display it as user friendly.. In TextArea, it will not get displayed properly and second thing is that, the user who modify it..is not technical. If he change any tags... or delete any tags... anything.. then xml will not parse...I want to display some predefined fields, whose data(content) can be change .. not the tag also.
Else for smaller file your approach is the best.
Sandeep Oza
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Since you have to vary only a set of elements value of the whole big xml file.
You can provide a small user interface(form based) to the user to edit the existing data, update the xml upon submit click.
Since you are using CSS encoding within XML, you can just use a jsp/servlet to read and write the xml file to the PrintWriter, which shd automatically show the HTML on the browser.


Spritle Software Blogs
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Edit xml(rendered as html) file and again save it
 
Similar Threads
How to Make Changes to an XML File and save them
Customizing JEditoPane to save HTML with xml extension
Open excel in browser
xml to print on html through java
XML->XSL->HTML