C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to use Escape Sequence with XML


Posted Date: 03 Feb 2008    Resource Type: Articles    Category: .NET Framework

Posted By: Vivek       Member Level: Gold
Rating:     Points: 10



How to use Escape Sequence with XML





There are two ways to use escape sequence
1) Either two replace these from their counterparts
2) Either use CDATA section for these.





1) First Way Using CData Section

If your text contains a lot of "<" or "&" characters - the XML element can be defined as a CDATA section.

All text in an XML document will be parsed by the parser.
Only text inside a CDATA section will be ignored by the parser.

2. Replace with their CounterParts

Illegal XML characters have to be replaced by entity references.

If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element. You cannot write something like this:

if salary < 1000 then

To avoid this, you have to replace the "<" character with an entity reference, like this:

if salary < 1000 then

There are 5 predefined entity references in XML:
Replace these with their counter part specified in B
A B
& &
< <
> >
" "
' '

Note: Only the characters "<" and "&" are strictly illegal in XML. Apostrophes, quotation marks and greater than signs are legal, but it is a good habit to replace them.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Replacing special character  .  Html  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Better Control over code in vs2008
Previous Resource: Improving Performance with Connection Pooling
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use