Restoring xml from a Zen Confluence to a non-Zen one

bbos November 4, 2013

Hi All,

My personal space at work is on Confluence 4.3.x running the Zen layout. I want to load that at home but I don't run Zen (or want to).

I exported the space as XML.

When I restore from backup it completes but the pages are all rendered with:

Unknown Macro: Zen-section

And nothing else. If i view source ('Storage format') I can see all the content.

I see the xml in question contains what looks like the zen macros in the ac namespace:

<ac:macro ac:name="zen-section"><ac:parameter ac:name="id">854539904</ac:parameter><ac:rich-text-body> ...

Perhaps I can just remove all elements with the ac namespace?

Is there an easy way to allow this restore to happen? I don't want to add the Zen layout but can as a temporary measure if necessary.

I wanted to ask here before playing with the XML first. Mmmm, maybe instead of 'exporting as xml' I should backup. I'll try that though given the restore worked I don't think this will produce a different result.

Thanks,

Brooke

5 answers

1 accepted

0 votes
Answer accepted
Kathy November 7, 2013

Hi Brooke,

I really wouldn't recommend editing the storage format. It's fussy work, and you'd be guessing at which parts you need to delete, and could corrupt the page.

A simpler option is to create a User Macro to replace the missing zen-section macro. This will eliminate the Unknown Macro errors and allow page content to display.

The User Macro should contain just the page body.

In the Admin Console's User Macro panel (in Confluence 4.0 and later), name the macro zen-section, and define the body as:

## @noparams

$body

NOTE: the "## @noparams" tag is required

bbos November 7, 2013

You're a legend Kathy, thanks. Twas fun to twiddle with the XML I'll have to admit.

0 votes
bbos November 6, 2013

Follow-up to last comment ...

It appears that all data AND presentation macros are in CDATA sections. I guess this prevents namespace issues but its kinda weird as CDATA is not meant to contain markup. I'm also seeing nested CDATA sections (which is illegal XML). Is this a problem caused by Zen or by Atlassian?

<property name="body"><![CDATA[<ac:macro ac:name="zen-section"><ac:parameter ac:name="id">854539904</ac:parameter><ac:rich-text-body><h1>Entity Manager</h1><h2>Monday 16/9/2013</h2><p>Last week I refactored the ESA2 application into Multi-Modules including splitting the Entities, <code>EntityProducer</code> and <code>persistence.xml</code> into the <code>esa2-data</code> project and the <code>CrudService</code> in the <code>esa2-persist</code> project.  The web application ... from the DB):</p><ac:macro ac:name="code"><ac:plain-text-body><![CDATA[java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory

I think I understand the processing model.

  1. The markup such as "<property .." that lies outside of these CDATA sections is the 'server-side' markup.
  2. Upon rendering a page the server gets what it wants from data and does whatever to prepare the pages. It essentially delivers what is in the CDATA sections to the presentation layer which may be Javascript running on the client. As far as the presenter knows the content is valid XHTML.

Sorry, thinking out loud (trying to make sense of what I see and understand it)!

0 votes
bbos November 6, 2013

Well more thoughts & feedback and I'm gonna keep babbling until I say something that pricks up someone's ears!

Another matter I didn't discuss in the question is that the Zen-section macro is in a CData section:

&lt;![CDATA[&lt;ac:macro ac:name="zen-section"&gt;&lt;ac:parameter ac:name="id"&gt;854539904&lt;/ac:parameter&gt;

I wonder if this just happened in the export since they are not normal CFL macros. But then why when I tried to restore from backup this XML did they get parsed? By definition CData data should not be parsed.

Has anyone any thoughts or knowledge of this?

0 votes
bbos November 5, 2013

OK no responses :(. Let me ask a different question - what elements are zen specific. I've done some simple tests and obviously

&lt;ac:macro ac:name="zen-section"&gt;

Is, and I'm not finding any other:

&lt;ac:parameter ac:name="id"&gt;

In my test pages though it sounds pretty generic. So I'll delete parameters that are at the start of a zen-section only.

Are there any others that are Zen specific (ie. a definitive list)?

0 votes
bbos November 5, 2013

There is no backup option in the CFL at work, only an 'export as XML'.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events