Restoring xml from a Zen Confluence to a non-Zen one
Asked by bbos:

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:

```
&lt;ac:macro ac:name="zen-section"&gt;&lt;ac:parameter ac:name="id"&gt;854539904&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt; ...
```

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


Answers:
author: Kathy
body: 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

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


author: bbos
body: 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?

```
&lt;property name="body"&gt;&lt;![CDATA[&lt;ac:macro ac:name="zen-section"&gt;&lt;ac:parameter ac:name="id"&gt;854539904&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;h1&gt;Entity Manager&lt;/h1&gt;&lt;h2&gt;Monday 16/9/2013&lt;/h2&gt;&lt;p&gt;Last week I refactored the ESA2 application into Multi-Modules including splitting the Entities,&amp;nbsp;&lt;code&gt;EntityProducer&lt;/code&gt; and&amp;nbsp;&lt;code&gt;persistence.xml&lt;/code&gt; into the&amp;nbsp;&lt;code&gt;esa2-data&lt;/code&gt; project and the&amp;nbsp;&lt;code&gt;CrudService&lt;/code&gt; in the&amp;nbsp;&lt;code&gt;esa2-persist&lt;/code&gt; project.&amp;nbsp; The web application ... from the DB):&lt;/p&gt;&lt;ac:macro ac:name="code"&gt;&lt;ac:plain-text-body&gt;&lt;![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)!


author: bbos
body: 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?


author: bbos
body: 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)?


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


Tags: confluence-administration

restore

xml

zen