-
Type:
Suggestion
-
Resolution: Answered
-
Component/s: Ecosystem
-
Environment:Confluence Server on Windows, approached through REST
Dear support,
For our automation needs, we are querying content from our Confluence instance through REST. No problem, works fine.
We use the default javax.xml.parsers.DocumentBuilderFactory to create a DocumenetBuilder. We feed the XML received from a REST call into this DocumentBuilder.
This fails for several reasons: the XML does not have the normal <?xml...> header, nor does it declare the correct namespaces for ac and ri etc. So before feeding it to the XML parser, we surround it with the required headers/footers.
That way, it works... most of the time.
But, Confluence uses a kind of XHTML and therefore the XML includes entity references such as & nbsp ; . Plain XML doesn't have these defined and therefore the DocumentBuilder complains with the following exception:
org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
This is normal behavior, since XML can't know these entities. So, my question is, which headers and footers we should add to the content XML in order not to run into any issues.
Unresolved entity references (XHTML and some Confluence custom ones?)
Unforeseen namespaces (we currently cover ac and ri, but maybe there are others...)
Since you developed Confluence, I guess you have a perfect answer to this instead of us guessing for the right choice.
Ideally, as I requested, you would provide us with a XML document in which we can "paste" the XML storage format, rendering a perfectly valid XML document.