How to save xml using oxygen aplet

Having trouble installing Oxygen? Got a bug to report? Post it all here.
masroor
Posts: 1
Joined: Tue Jul 22, 2014 8:53 am

How to save xml using oxygen aplet

Post by masroor »

Hi,

We have setup oxygen applet in our local system and deploy in tomcat. We want to save xml after edit xml by using applet.

http://www.oxygenxml.com/demo/AuthorDem ... -dita.html

In Frequently Asked Questions they are given below comments

"The save operation could be implemented either in Javascript by requesting the XML content from the Applet or in Java directly working with the Author component. You would be responsible to send the content back to the CMS."

How to implement these in our oxygen applet. Sample code would be more helpful.


Regards,
Mohd Masroor
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: How to save xml using oxygen aplet

Post by alex_jitianu »

Hello,

First of all, using EditorComponentProvider.getWSEditorAccess() you get access to the following API:

1. ro.sync.exml.workspace.api.editor.WSEditorBase.save() - this methods opens an output stream to the URL of the editor and saves in it. The protocol must support output writing. You said you have deployed the applet inside a Tomcat server. Does the edited files come from the same server? As far as I know Tomcat supports WebDAV. If these files are hadled by Tomcat's WebDAV servlet, then just by using this WSEditor.save() API you will save the document.

2. ro.sync.exml.workspace.api.editor.WSEditorBase.createContentReader() and ro.sync.exml.workspace.api.editor.WSEditorBase.createContentInputStream()
2.1 You can use this API from the Java code. Maybe from an action on the toolbar. What you do next with the reader is up to you. Maybe use a PHP script to upload the content to the server. For example something like:

http://bytes.com/topic/java/answers/720 ... quest-java

Or maybe just use the PUT method over HTTP.
2.2 You can create a method in your javax.swing.JApplet implementation that uses these methods and returns the content as a String. Next, by Invoking Applet Methods From JavaScript Code you can write Java script that invokes this method, gets the content and does something with it. Maybe on the Tomcat server you have a Servlet that can save a resource. In this case you could use an AJAX request to send data to the servlet.

Best regards,
Alex
Post Reply