Org. xml. Sax. saxparseexception: content is not allowed in trailing section.

Source: Internet
Author: User

<Personal summary, for reference only!>

 

The exception as following:

 

[Fatal error] server. msdk. Perf. All. xml: 192: 1: content is not allowed in trailing section.

Org. xml. Sax. saxparseexception: content is not allowed in trailing section.

At com.sun.org. Apache. xerces. Internal. parsers. domparser. parse (unknown source)

At com.sun.org. Apache. xerces. Internal. JAXP. documentbuilderimpl. parse (unknown source)

At javax. xml. parsers. documentbuilder. parse (unknown source)

...

...

 

When this problem occurs, check the parse file to check whether the file is correct. In general, this file is faulty, especially if the file is generated by code, check whether the file is correct. There may be an extra space at the end of the file or an incorrect tag at the end of the file.

 

Addition:

 

When using Java stream to read and write files, if you read a byte array with a fixed size from inputstream each time

 

Byte [] array = new byte [1024];

Bufferedinputstream buffinput = new bufferedinputstream (inputstream );

Fileoutputstream fileos = new fileoutputstream (targetfile );

Bufferedoutputstream buffos = new bufferedoutputstream (fileos );

Int word = 0;

While (WORD = buffinput. Read (array ))! =-1 ){

Buffos. Write (array );

}

 

This may cause less than 1024 of the last read to the array, the previous read bytes will also appear in the byte [], so it is best to use

 

Bufferedinputstream buffinput = new bufferedinputstream (inputstream );

Fileoutputstream fileos = new fileoutputstream (targetfile );

Bufferedoutputstream buffos = new bufferedoutputstream (fileos );

Int word = 0;

While (WORD = buffinput. Read ())! =-1 ){

Buffos. Write (Word );

}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.