Attention

This document was written for an unsupported version of Plone, Plone 2.1.x, and was last updated 1240 days ago.

For more information, see the version support policy.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Getting and Editing XML

by Paul Everitt last modified Dec 30, 2008 03:05 PM
Now that the ATXML marshaller is configured, let's work with it.

So good news, you already have reached a point of success!  Visit Plone's front-page in a browser and add manage_FTPget to the URL, as shown in the URL bar below:

Viewing XML from Marshal


Ahh, look at all that XML goodness, ain't she beautiful?  But can we edit an existing entry?  Let's use the cadaver command-line DAV tool and find out:

$ cadaver http://localhost:8880/atxml/
$ edit front-page

Note the usage of the WebDAV port number!!  Depending on your editor settings, the second command will give you an editor such as vi.  Change the value of the <dc:title> element, then save and exit the editor.  cadaver will send the changes to Plone and unlock the resource.

Re-open the Plone front page in a web browser.  You should see your new title.  Cool, eh?

Some notes on this:

  1. Eagle-eyed observers will note that the body field was, errm, how shall we say this....encoded. In the case of Marshall 0.6, if a field's contents are HTML, the Marshaller puts the content in a CDATA.  Why?  Because we can't promise that the HTML is well-formed XML.  Future versions of Marshall might revisit this policy.  Note that image and file field contents are currently not serialized.
  2. cadaver has a helpful readline mode, if your compilation supported it.
  3. This XML format is in flux!  Sidnei and I are discussing how to get more "meaning" out of Plone, in a way that fits the median of expectations.

I like using the oXygen editor, as noted above.  With oXygen I can open the Plone site, browse to front-page, and edit the content in a real XML editor.  I can even download the Relax NG schema for Marshall and validate before saving.

In this next screenshot, I show browsing the contents of the Plone site using oXygen's WebDAV browser:

oXygen Browsing

I double-click to open front-page and tell oXygen that this is an XML document (lack of file extension means it couldn't guess).  In the next screenshot, I have the front-page, exported as ATXML, open for editing.  I have changed the dc:title and I have also associated the Relax NG schema with this page, thus giving me the inspector on the right:

oXygen Changed


Finally, I show the schema validation in action.  I mistakenly change the id attribute on a field to be xid, which is not allowed in the schema.  Note the red underline, the completely accurate warning message in the status bar, and the appearance of the right-hand inspector pane:

oXygen Validator












Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.