2013-09-11 4 views
0

Я пытаюсь получить HTML-страницу из API Atlassian Confluence, но он возвращает такой контекст. Как я могу преобразовать их в стандартные HTML-теги?Как преобразовать XML в HTML?

<p style="text-align: center;">&nbsp;</p> 
    <p><span style="color: rgb(153,153,153);"><br /></span></p> 
    <h2><ac:image><ri:attachment ri:filename="welcome.png" /></ac:image><br />&nbsp; <span style="color: rgb(128,128,128);">With Confluence it is easy to create, edit and share content with your team. Choose a topic below to start learning how.</span></h2> 
    <h2><span style="color: rgb(0,0,128);"><br /></span></h2> 
    <ol> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="What is Confluence? (step 1 of 9)" /><ac:link-body>What is Confluence?<br /><br /></ac:link-body></ac:link></span></li> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="A quick look at the editor (step 2 of 9)" /><ac:plain-text-link-body><![CDATA[A quick look at the editor]]></ac:plain-text-link-body></ac:link><br />&nbsp;</span></li> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="Let's edit this page (step 3 of 9)" /><ac:plain-text-link-body><![CDATA[Let's edit this page]]></ac:plain-text-link-body></ac:link><br /><br /></span></li> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="Prettify the page with an image (step 4 of 9)" /><ac:link-body>Prettify the page with an image<br /><br /></ac:link-body></ac:link></span></li> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="Get serious with a table (step 5 of 9)" /><ac:link-body>Get serious with a table<br /></ac:link-body></ac:link></span><span style="color: rgb(0,0,128);">&nbsp;</span></li> 
     <li><span style="color: rgb(0,0,128);"><ac:link><ri:page ri:content-title="Lay out your page (step 6 of 9)" /><ac:plain-text-link-body><![CDATA[Lay out your page]]></ac:plain-text-link-body></ac:link>&nbsp;<br /><br /></span></li> 
     <li><ac:link><ri:page ri:content-title="Learn the wonders of autoconvert (step 7 of 9)" /><ac:plain-text-link-body><![CDATA[Learn the wonders of autoconvert]]></ac:plain-text-link-body></ac:link>&nbsp;<br /><br /></li> 
     <li><ac:link><ri:page ri:content-title="Tell people what you think in a comment (step 8 of 9)" /><ac:plain-text-link-body><![CDATA[Tell people what you think in a comment]]></ac:plain-text-link-body></ac:link>&nbsp;<br /><br /></li> 
     <li><ac:link><ri:page ri:content-title="Share your page with a team member (step 9 of 9)" /><ac:plain-text-link-body><![CDATA[Share your page with a team member]]></ac:plain-text-link-body></ac:link><br /><br /></li> 
     <li><a href="http://directory.apache.org">Apache Directory</a></li> 
    </ol> 
    <p><span style="color: rgb(128,128,128);"><br /></span></p> 
    <p><span style="color: rgb(128,128,128);"><br /></span></p> 
    <p><span style="color: rgb(128,128,128);"><br /></span></p><p style="text-align: right;">&nbsp; &nbsp; &nbsp;&nbsp;</p>  
+0

'p',' h2', 'ol' - это уже "стандартный HTML-теги"; все остальные просто игнорируются браузерами – Cherniv

+0

Я знаю, что p, h2, ol - это теги html. Но таблица стилей не работает с этими тегами. – maskapsiz

+0

Что ты имеешь в виду? отлично работает для меня: http://jsfiddle.net/cherniv/KM6y8/ – Cherniv

ответ

2

<ac:image> <ri:attachment../> т.д. Confluence XHTML макросы и воздастся самым слиянием на выходе страницы. вам нужно вызвать метод визуализации слияния api, чтобы получить это преобразованное html.

Confluence предлагает вам функцию, что в слиянии remote SOAP API -> Страница -> Управление:

String renderContent(String token, String spaceKey, String pageId, String content) 
Смежные вопросы