Hexadecimal value is one of the solutions to invalid Character Errors

Source: Internet
Author: User
Tags printable characters

Xmldocument. Load

DS. readxml

Error message. error message: The hexadecimal value 0x0 B is invalid.

The cause is that the XML file contains low-level non-printable characters.

Solution: Filter low-level non-printable characters when generating XML files

 

Public static string replaceloworderasciicharacters (string TMP)
{
Stringbuilder info = new stringbuilder ();
Foreach (char CC in TMP)
{
Int Ss = (INT) CC;
If (SS> = 0) & (SS <= 8) | (SS> = 11) & (SS <= 12 )) | (SS> = 14) & (SS <= 32 )))
Info. appendformat ("", SS); // {0: x };
Else info. append (CC );
}
Return info. tostring ();
}

ArticleSource: http://www.diybl.com/course/4_webprogram/asp.net/asp_netshl/2008828/138213.html

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.