Hello,
I'm trying to search and edit the body of a confluence page. I can get the body (PageManager -> Page -> getBody) as String, modify it and save it. But I have to find a special macro and I think it's not proper way to make a string search.
Here my questions:
1. Is there any XHTML parse API from Atlassian to easy find macro or add some content?
2. If not I tried to parse the XHTML with the dom4j, but the body content is not a valid xml. Missing the name spaces and also don't accept the . Is it possible to get and modify a valid xml?
Community moderators have prevented the ability to post new answers.
You could store the body content of the macro as a content property with the page (look for ContentPropertyManager), and read it from there.
Hth,
-Stefan
First of all, that approachs does not scale very well. Esp. when you use JDOM to parse the body content.
Instead, to search in confluence you should use lucene queries (look for LuceneSearcher) To search for a macro, which doesn't work out of the box, the macro indexer plugin [1] should help, a intro about the search syntax can be found at [2].
Hope this helps,
-Stefan
[1] https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.confluence-macro-indexer-plugin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer. I think this is not what I'm looking for. Perhaps I have to do a better description for our problem.
We are developing a help system for our application, based on Confluence. The user who is writing the help should be able to click for example on a textfield in our application and then this will add some content in a special page in the Confluence. So for this we have to edit the content of a page. If the user is clicking on an existing label it should return the right text. By the way this text somewhere on a confluence page, marked by a special macro.
Technical solution actual:
REST service for the communication between our application and the Confluence. Search for a macro tag, add it if necessary. Actaully the only way is to do the search and add with string manupulation. Is this really the way? Or did I undestand something wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.