Hi team ,
I have HTML file and want to upload the content of that HTML file in newly created confluence . I am able to create a confluence page using confluence.create_page command and able to add the static content to it . but whenver i m trying to read the contents of HTML page and trying to load it i am getting below error .
Error parsing xhtml: Unexpected character ' ' (code 32) in content after '<' (malformed start element?).
Can you please help me with this issue
HTML page looks like below
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.
This is going < to print
This is going > to print
</p>
</body>
</html>
---code
status = confluence.create_page('ABCD' ,#space,
'Report',#title
content ,#'This is the HTML body',,
parent_id=123456,### this is the pageid of the page under which new page
will be created
type='page',
representation='storage',
editor='v2')
I am going to guess that it is the format of your input file. I think you may need to strip the HTML and Body tags. The command syntax is as follows
confluence.create_page(space, title, body, parent_id=None, type='page', representation='storage', editor='v2')
There are also some examples here:
@Bill Bailey This command can be used to create a page in confluence.Actual issue which i am facing the parsing the html content which is having special charactor like "=,===,' " and some unwanted space before and after these character. there are libraries which can be used for parsing like beautiful soup, html parsar but these are restricated to <.>.& charactors.
Can you please anything to resolve these issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
High @yatindra kumar janghel , I am not a Python expert, but was just looking at what was published to figure out the error. I think if you just strip the html and body tags, the command would work. I would try that as an experiment to see if it is indeed the source of the error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Bill Bailey Thanks for the response. by removing the html and body tags , i am able to copy the content to confluence page, lost the structure of the HTML page .Can you help me how i can maintain the structure of HTML page intact
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.