Is this a valid XML file?

I need to send some XML element to some other services and I want my XML file to be nicely formatted so that other people can use their XML parser to parse the XML file.

For such XML files, is this an elegant format that violates any XML rules? Not sure if & # x4 are valid XML character sequences in .Net / C #?

I am confused about the fact that all lines start with $ # x. If not all of them are valid, is it possible to filter them out?

I am using VSTS 2008 + C # + .Net 3.5.

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

      

+2


source to share


3 answers


Not. Symbol references must be terminated with semi-colonies.

Update. Considering the syntax error in the question has been fixed, see http://www.w3.org/TR/xml/#dt-charref for a description of the valid values.



To be honest, I stick with UTF-8 for everything except ", <,> and &. This makes the XML more readable.

+7


source


Use XML Validator . It shows the following error:



Error: symbolic link must end with ';' separator.

+5


source


As others have stated, the semicolon was missing and was using a validator. But also note that not all characters are legal, even if the input format is technically ok.

The following document, if it fails validation:

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

      

This is confirmed:

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

      

For information on symbols to use or avoid, this seems interesting .

+2


source







All Articles