XML illegal character (escape character) _xml base
Source: Internet
Author: User
As usual,
The customer sent me an XML file
To update the digital classroom schedule--is a JS read XML file to the mouse through the calendar shows the effect of the daily course schedule, there are classes in AJAX data read (but the data is completely static update) of the script program
Because it's two sides to complete the entire schedule update (the customer separates the production page from the update site),
There's always a problem with the XML file you gave me,
Because it's often done, knowing that the producer is still relatively rudimentary at the level of HTML code,
So you always have to correct the files before each update,
There is still a problem,
As usual, I check that each label in the file content is complete,
Check out a mistake and feel OK
But the page still shows failed to read the XML data,
I checked the label from beginning to end (the file was pretty long, I'm so pathetic, whining ~ ~ ~),
Incredibly did not find anything wrong, hey, dizzy, depressed ~ ~ ~ ~,
Helpless, had to copy the code out,
And then in a copy, the edge of the copy page to refresh the preview effect,
Back and forth several times, and finally found that there are several code problems,
There seems to be nothing wrong with the syntax ~ ~, the label is complete ~ ~
Suddenly found in the content there are "&", hateful,
Always stare at the label for half a day, forgetting that there may be a conflict of characters in the content,
It's good to be replaced.
In order to understand the details, I checked the w3school:
Escape character
Illegal XML characters must be replaced with entity references (entity reference).
There are 5 predefined entity references in XML:
< < less than
> > Greater than
& & and number
' Ellipsis
"" Quote
Note: Strictly speaking, only characters "<" and "&" in XML are illegal. ellipses, quotes, and greater-than numbers are legal, but it's a good practice to replace them with entity references.
So, the truth,
I blame myself for bad luck, and I don't know enough about XML.
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.