Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:12:35+00:00 2026-05-26T15:12:35+00:00

I have an XML document that contains special characters like ‘%’, Carriage return, line

  • 0

I have an XML document that contains special characters like ‘%’, Carriage return, line feed, &, <, >, ‘, “. I have tried to encode the entire xml document but that fails to load when using xmldocument.load method in C#.

What is the best way to remove these special characters without having to hardcode to replace the illegal chars with corresponding entity references?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:12:36+00:00Added an answer on May 26, 2026 at 3:12 pm

    The short answer is that an XML-like document with invalid characters isn’t a valid XML document, and needs to be made valid.

    You have two possible fixes. The first, which you’ve already hinted at, is to replace the invalid characters with entities. The second would be to wrap any content with invalid characters in CDATA sections; you won’t have to deal with any kind of encoding issues for content in those sections.

    If neither of those is an option, you’re going to need to figure out how to parse the document with a parser that doesn’t care about invalid characters, which is probably a bad idea, and should be avoided if at all possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML document that contains items with dashes I'd like to strip
I have an XML document which contains an element that is over 90,000 characters
I have an xml document that contains some html. <begin-line> <verse-num>6</verse-num>a mixed people<footnote id=f2>
I have an XML document (generated by Adobe XFA forms), that contains data like
Situation: I have a simple XML document that contains image information. I need to
I have an xml document that looks like this. <foo> <bar type=artist/> Bob Marley
Say I have a xml document that looks like this <foo> <bar id=9 />
In my Python app, I have an XML document that I'd like to transform
I have a simple xml document that looks like the following snippet. I need
I have a .gz file that contains an XML document. Does anyone know how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.