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

  • SEARCH
  • Home
  • 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 6203177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:52:04+00:00 2026-05-24T04:52:04+00:00

When should we replace < > & ‘ in XML to characters like &lt

  • 0

When should we replace < > & " ' in XML to characters like &lt etc.

My understanding is that it’s just to make sure that if the content part of XML has > < the parser will not treat is start or end of a tag.

Also, if I have a XML like:

<hello>mor>ning<hello>

should this be replaced to either:

  • &lthello&gtmor&gtning&lthello&gt
  • &lthello&gtmor>ning&lthello&gt
  • <hello>mor&gtning<hello>

I don’t understand why replacing is needed. When exactly is it required and what exactly (tags or text) should be replaced?

  • 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-24T04:52:06+00:00Added an answer on May 24, 2026 at 4:52 am

    <, >, &, " and ' all have special meanings in XML (such as “start of entity” or “attribute value delimiter”).

    In order to have those characters appear as data (instead of for their special meaning) they can be represented by entities (&lt; for < and so on).

    Sometimes those special meanings are context sensitive (e.g. ” doesn’t mean “attribute delimiter” outside of a tag) and there are places where they can appear raw as data. Rather then worry about those exceptions, it is simplest to just always represent them as entities if you want to avoid their special meaning. Then the only gotcha is explicit CDATA sections where the special meaning doesn’t hold (and & won’t start an entity).

    should this be replaced to either

    It shouldn’t be represented as any of those. Entities must be terminated with a semi-colon.

    How you should represent it depends on which bit of your example of data and which is markup. You haven’t said, for example, if <hello> is supposed to be data or the start tag for a hello element.

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

Sidebar

Related Questions

Well actually I know, that I should replace & by %26 But I'm using
I would like to write a macro for Notepad++ which should replace char1, char2,
What are the dangerous characters that should be replaced in user input when the
I have a macro that I use to replace special characters for its html
In a recent sharepoint project, I implemented an authentication webpart which should replace the
I want to replace leading space with &nbsp; with the same number of occurrences.
Im not sure that it is the right way but I use this functions
I'm using FlowPlayer to replace an existing FLV player on my site that plays
I know that I should encodeURI any url passed to anything else, because I
I'm trying to do a replace on the following string prototype: I&amp;lsquo;m singing &amp;

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.