views:

185

answers:

1

a day before end of project i run into a complicated issue: i have a wtf service and 3 client application using it. service has three methods, each one receiving an xml document as an argument and returning xml document. this is how they communicate. i've got some xsd files to validate generated and received xml's. till today everything worked fine. i've got polish windows and today i run my application on english windows. as you probably realised this far, i got a message from my application that the received xml is not valid. i checked it and the VaR value that was suppopsed to be double in the xml was written with period (or coma, i don't remember but it wasn't working). i'm wondering now - is there any good solution 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;
        }

there is no way i could tell the validator what the separator in double should be. the only solution i could think of is to simply specify in xsd that the problematic VaR value is a string and then check programmaticaly if it is a double number, with period or coma.

A: 

The XML schema spec specifies that floating point numbers are represented using a period and not using a comma. The locale doesn't have any affect on what is valid XML.

You don't include your error. Hopefully it is complaining that there is a comma in a number.

David Norman
thanks! that solves the problem
agnieszka