Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invalid XML file?

Tags:

format

xml

I wrote the following file in Visual Studio 2008 as a new XML file, and it reports the following error. What is the error message about and why it is treated as a wrong format XML file?

Here is the XML file and related error message.

<?xml version="1.0" encoding="utf-8"?>
<Foo>&#x2;</Foo>

Error   1   Character ' ', hexadecimal value 0x2 is illegal in XML documents.   XMLFile1.xml    2   6   Miscellaneous Files

thanks in avdance, George

like image 480
George2 Avatar asked Aug 21 '26 04:08

George2


2 Answers

Your problem is the reference to &#x02, which essentially is random binary data that can not be printed. This is not allowed in XML1.0 (it is in XML 1.1 and higher, but it's not certain that your .Net version will allow it even if you change XML versions).

like image 112
Mia Clarke Avatar answered Aug 23 '26 22:08

Mia Clarke


I wrote the following file in Visual Studio 2008 as a new XML file, and it reports the following error. What is the error message about and why it is treated as a wrong format XML file?

According to the W3C XML 1.0 Specification, the only characters allowed in an XML document that are below &#x20; are the tab (09), newline (0A) and carriage return (0D).

XML 1.1 allows almost all characters, excluding 00, but is very rarely implemented and one should not rely on finding an XML 1.1 implementation.

Even in the XML 1.1 Spec. it is said that the use of the now allowed characters below &#x20; "is strongly discouraged".

like image 39
Dimitre Novatchev Avatar answered Aug 23 '26 23:08

Dimitre Novatchev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!