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

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
Accepted answer

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

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

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

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

<ac:macro ac:name="zen-section">

Is, and I'm not finding any other:

<ac:parameter ac:name="id">

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)?

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:

<![CDATA[<ac:macro ac:name="zen-section"><ac:parameter ac:name="id">854539904</ac:parameter>

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?

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)!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,002 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you