Code Block Macro not works with XML format

Hananya Beck July 25, 2017

"code block" macro works fine for C# and SQL and more.

But when i use it for XML it display me empty content.

I tried with and without the next header:
<?xml version="1.0" encoding="UTF-8"?>

1 answer

0 votes
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2017

Which version of Confluence are you using (Server/Cloud, if Server, which version number)?

In general, the Code Block macro works for XML, but it might have something to do with your particular version of Confluence and/or what kind of XML you are trying to display.

Hananya Beck July 25, 2017

Cloud.

 i tried many simple XML.

Please try it to verify it is works now in the Cloud version.

Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2017

Have you switched to the new interface?

I tested it in the old interface, and it worked fine.

I tested it in the new interface, and it didn't work to paste the XML code (the tags got stripped out), but typing the XML code directly worked ok.

Another option might be to install the Better Code Macro (free from Atlassian Labs), and that might work better for you.

Hananya Beck July 25, 2017

How can i know if i used the old or new interface?

I am new user 2 weeks ago.

(my tags also got stripped out).

 

I will use the Better Code Macro.

 

Thanks

Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2017

If you are a new user, then you're probably on the new interface. It's the one with bright blue instead of dark blue, and with the main menu on the left side instead of the top.

I figured out a workaround to get past the XML pasting issue:

Put the cursor where you want the code macro to go, then click "➕ ", and "Markup".

In the box that pops up, make sure Confluence Wiki is selected, then type {code}, paste your XML, and then type {code} again.

Click the "Insert" button, and then you should have the code macro with the code inserted properly, and you can edit the options to choose "HTML and XML" to highlight the content properly.

Hananya Beck July 25, 2017

Hi

Yes. i with the new interfcae.

Great workaround. Works fine.
Thanks.

If you will fix the problem it will be excellent.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events