Escapes or unescapes an XML file removing traces of offending characters that could be wrongfully interpreted as markup.
The following characters are reserved in XML and must be replaced with their corresponding XML entities:
- ' is replaced with '
- " is replaced with "
- & is replaced with &
- < is replaced with <
- > is replaced with >
Original CharacterXML entity replacementXML numeric replacement
< < <
> > >
" " "
& & &
' ' '
< < <
> > >
" " "
& & &
' ' '
Examples:-
Data | Xml Type | In XML |
He said "OK" | Attribute | attributeName="He said "OK"" |
She said "You're right" | Attribute | attributeName="She said "You're right"" |
Smith&Sons | Attribute | attributeName="Smith&Sons" |
if (age > 3 && age < 8) | Element | <MyElement>if (age > 3 && age < 8)</MyElement> |
An XML Comment End with --> | Comment | <!-- An XML Comment End with --> --> |
A & B | Comment | <!-- A & B --> |
No comments:
Post a Comment