Home : OpenEdit SDK : Programming OpenEdit : XML Editing
XML Editing
The XmlModule provides a basic Create Read Update Delete features for a simple one level XML structure.Setup Action
To create a simple editor or display an XML format you will want to an action to your page's xconf file. We will use an example editor located in /openedit/update/editsites.xconf:<page>
<page-action name="Xml.loadXmlFile">
<path>/openedit/update/sites.xml</path>
<fileid>sites</fileid>
<element-name>site</element-name>
<attribute id="id" description="Id" size="5" />
<attribute id="text" description="Text" size="20 "/>
<attribute id="href" description="Adddress" size="20"/>
</page-action>
</page>
path - This points to the XML file you want to create.
fileid - A unique name we use to refer to this file on the edit forms
element-name - The name of the main elements we are editing
attribute - A listing of what attributes should be managed on the editor
Editor Screen
You can then create our own copy of or just pull in the existing editor screen:$pages.stream("/openedit/editors/xml/embeded.html")
XML Output
The resulting XML for this example:<sites>
<site id="dev" text="Development Site" href="http://localhost:8080/beta/"/>
<site id="stage" text="Staging Site" href="http://localhost:8080/qa/"/>
<site id="prod" text="Production Site" href="http://localhost:8080/"/>
</sites>
