How do I create an XML output for a page?
An XML Output gives you a way to see the system-generated XML behind a page — invaluable when writing or debugging a Format.
- Create a new Template containing only
<system-region name="DEFAULT"/>. - Navigate to Manage Site > Configuration.
- Select your existing Configuration and edit it.
- Click Add new Output.
- For Name, enter "XML".
- For Template, browse to the Template from step 1.
- For File Extension, enter ".xml".
- For Type of Data, select "XML".
- Leave Publishable unchecked for now.
- Click Submit.
Now navigate to a page using that Configuration, click the Output drop-down, and select "XML" to see the generated XML.
If you see a "Root element not set" error
Bash
Could not convert JDOM document into string: Exception outputting Document: Root element not set
Change the Template content from:
HTML
<system-region name="DEFAULT"/>
to:
HTML
<xml>
<system-region name="DEFAULT"/>
</xml>
This ensures the content within the DEFAULT region always has a root element.
Context-sensitive Index Blocks
The XML configuration's DEFAULT region is a useful place to plug in context-sensitive Index Blocks. An Index Block with Rendering Behavior set to "Start at the current page..." only generates XML once it's attached to a page region. To see its output for a given page:
- Click Edit on the page.
- Click the Configure pane.
- Click the XML Configuration.
- In the DEFAULT region, use the Block chooser to select the Index Block.
- Click Submit.
Return to the page view and select the XML output to see the XML the Index Block generates for that page.