Is XML validation vulnerable to culture information?

the day before the completion of the project I am facing a tricky problem: I have a wtf service and 3 client applications using it. the service has three methods, each of which takes an XML document as an argument and returns an XML document. that's how they communicate. I have some xsd files to validate the generated and received xml. everything worked fine until today. I have polished windows and today I am running my application on english windows. as you probably guessed it, I got a message from my application that the resulting XML is not valid. i checked it and the VaR value that was suppopsed double in xml was written with period (or coma, I don't remember, but it didn't work). I'm wondering now - are there any good solutions for this problem? i mean i validate xml like this:

public bool IsValid(XDocument xmlDocument, Stream xsdContent)
        {
            XmlSchemaSet schemaSet = new XmlSchemaSet();
            XmlReader reader = XmlReader.Create(xsdContent);
            schemaSet.Add(string.Empty, reader);

            valid = true;
            xmlDocument.Validate(schemaSet, (sender, eventt) => { valid = false; e
= eventt; });

            return valid;
        }

      

I can't tell the validator what should be the delimiter in the double. the only solution I could think of is to simply indicate in the xsd that the problematic VaR value is a string and then check programmatically if it is a double with a period or coma.

0


source to share


1 answer


the XML Schema specification specifies that floating point numbers are represented using a period and do not use a comma. The locale does not affect valid XML.



You did not indicate your error. Hopefully he is complaining that there is a comma in the quantity.

+2


source







All Articles