There are several methods in which content can be retrieved from an instance of the EditLive! for Java Swing applet:
- Using the Save and Save As... Menu and Toolbar Items.
- Using the ELJBean methods
The EditLive! for Java Swing provides methods to allow access to an editor's content at any time.
- Allowing EditLive! for Java Swing to Explicitly Call a HTTP Post.
EditLive! for Java can explicitly call a HTTP Post using the PostDocument action for a customToolbarItem.
Using the Save and Save As... Menu and Toolbar Items
Using the Save and Save As... menu and toolbar items, users can save the entire XHTML document stored in EditLive! for Java Swing to their local machine.
These items are specified through an EditLive! for Java Swing configuration file. These items can be added by manually editing the configuration file. If manually editing a configuration file, see the Menu and Toolbar Item List, <menuItem> and <toolbarButton> sections of this SDK.
Using the ELJBean methods
EditLive! for Java provides two methods to extract the content of the editor:
This property returns the entire XHTML document currently stored in EditLive! for Java Swing. The returned value is a Java String.
This property returns only the content nested between the <body> tags in EditLive! for Java Swing. The actual <body> tags are not included. The returned value is a Java String.
This example shows how to use the getDocument() method.
Using EditLive! for Java Swing to Explicitly Call a HTTP Post
EditLive! for Java Swing can be configured to post its content directly to a Post Acceptor Script on a Web server. This is done by either using the raiseEvent() method of the ELJBean class, or using the value PostDocument for the action attribute of a custom menu or toolbar item. This is useful in situations where EditLive! for Java Swing cannot post its content as part of the HTML form submission architecture.
Using the ELJBean raiseEvent() Method to Generate a HTTP Post
Using the Java APIs packaged with EditLive! for Java Swing, developers can create TextEvents specifying a HTTP Post and the information to send with this post. This TextEvent can then be used with the ELJBean raiseEvent() method to fire the HTTP Post.
Retrieving the Content of EditLive! for Java Swing from a HTTP Post
Using HTTP Posts creates two separate methods for retrieving the content of the EditLive! for Java Swing editor:
Accessing the content via the Post Acceptor Script.
The following examples show using a server-side language to access the document of an instance of ELJBean. This example assumes the content of ELJBean was sent in a field called ELContent. For more information on sending HTTP Posts see the <customMenuItem> configuration file element.
Ensuring Output is XHTML or XML Compliant
In order to ensure that the output of content in EditLive! for Java Swing is XHTML or XML compliant, specific attributes in the <htmlFilter> configuration file element have to be set.
For XHTML compliant output, the following filter settings are required:
- Set outputXHTML to true - This ensures that XHTML tags are used (i.e. <br/> instead of <br>).
- Set allowUnknownTags to false - This ensures that no tags outside of the XHTML standard are used, i.e. custom tags. Instead, custom tags are HTML encoded.
- Set encloseText to true - This ensures content is correctly nested inside the relevant parent tags.
For XML compliant output, the following filter settings are required:
- Set outputXML to true - this ensures that special characters are encoded as numeric entities and that XML style tags are used (i.e. <br/> instead of <br>).
- Set encloseText to true - This ensures that the content is correctly nested inside the relevant parent tags.