How do I create an XML output for a page?

To create an XML Output for a page:

  • Create a new Template with only the following content: <system-region name="DEFAULT"/>
  • Navigate to Manage Site > Configuration.
  • Select your existing Configuration and edit it.
  • Click Add new Output.
  • For the Name field, enter "XML".
  • For the Template field, browse to the Template that was created in the first step.
  • For the File Extension field, enter ".xml".
  • For the Type of Data field, select "XML".
  • Leave the Publishable field unchecked for now.
  • Click Submit.

Now, navigate to a Page asset which is using the Configuration that was just modified. While viewing the Page, click the Output drop down menu and select "XML". Clicking on this output will display the system generated XML for that Page.

In some cases, viewing the XML content of a page will result in the following error message:

Could not convert JDOM document into string: Exception outputting Document: Root element not set

To resolve this, try changing the Template content from:

<system-region name="DEFAULT"/>

to:

<xml>
    <system-region name="DEFAULT"/>
</xml>

This will ensure that the content within the DEFAULT region always has a root element.

It's often helpful to use the XML configuration's DEFAULT region for plugging in context-sensitive Index Blocks. For example, any Index Block with Rendering Behavior set to "Start at the current page..." will mean that the Block must be plugged into a Page region before it will generate any XML. To see the XML output for a given page that uses a context-sensitive Index Block:

  • Click Edit on the Page.
  • Click the Configure pane.
  • Click the XML Configuration
  • In the DEFAULT region, click the Block chooser and select the Index Block.
  • Click Submit.

Now, return to the Page view and select the XML output. It will display the XML generated by the Index Block as it pertains to the Page.