Content is not allowed in the Trailing Section

Post here questions and problems related to editing and publishing DITA content.
koushik9020
Posts: 16
Joined: Tue Dec 06, 2022 11:21 am

Content is not allowed in the Trailing Section

Post by koushik9020 »

Hi Oxygen Support Team,

We are using CLOB_CONTENT column (from Oracle XML DB) to download the XML, DITA, DITAMAP files for one of our use cases as per the requirement with the below block of code.

Code: Select all

                        Clob clobObject = baselineObject.getClobContent();
			Reader clobReader = clobObject.getCharacterStream();
			StringBuilder sb = new StringBuilder();
			char[] buf = new char[1024*8];
			int n;
			while( (n = clobReader.read(buf)) >= 0 ) {
				sb.append(buf);
			}
			ByteArrayInputStream returnInputStreamofFile = new ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8));
			remoteFile = returnInputStreamofFile;
			updateLocalFileContent(targetFile, remoteFile);
	
Which is actually downloading the file to local storage without any issues, but as part of the same requirement we had to open the bookmap file in Oxygen automatically once it's downloading. While opening this file in Oxygen once download is completed seeing this below error in Oxygen:

Screenshot 2024-06-12 at 4.34.44 PM
Screenshot 2024-06-12 at 4.34.44 PM.png
Screenshot 2024-06-12 at 4.34.44 PM.png (496.47 KiB) Viewed 476 times
When I click yes from above dialog , this is shown:

Screenshot 2024-06-12 at 4.34.55 PM

Clicking ok will take you to opening of the file in Text Mode instead of Author mode with some validation errors.

Screenshot 2024-06-12 at 5.32.44 PM
Screenshot 2024-06-12 at 4.34.55 PM.png
Screenshot 2024-06-12 at 4.34.55 PM.png (566.82 KiB) Viewed 476 times

We are not seeing the same problem if we use XML_Content to use for the file downloading.


please suggest what's this error regarding and why does this occur, so that we can see the ways of fixing this. As our main requirement here is to focus on using CLOB_CONTENT for download instead of XML_CONTENT.
Radu
Posts: 9179
Joined: Fri Jul 09, 2004 5:18 pm

Re: Content is not allowed in the Trailing Section

Post by Radu »

Hi,
In my opinion when you read from the reader:

Code: Select all

n = clobReader.read(buf)) >= 0 
that "n" variable holds the useful length from the "buf" which has been filled by the reader.
So I would assume something like this might fix the problem:

Code: Select all

sb.append(buf, 0, n);
Of course you can add some logging to list the content you are adding to the string builder and double check if this is indeed the problem.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
koushik9020
Posts: 16
Joined: Tue Dec 06, 2022 11:21 am

Re: Content is not allowed in the Trailing Section

Post by koushik9020 »

Thank you Radu!

We were able to fix this.
Post Reply