Hi every body, I am having a problem and I need your help, please
I am using a XSD file; it has several nodes that have the following
definition:
<element name="guarantyPercent" type="decimal" />
As you can see, the type of guarantyPercent is decimal.
In the XML file the guarantyPercent can be empty:
< guarantyPercent />
(note: the XML File is not mine, this file comes from another company and is
sent to me every five minutes, and for this reason I cannot change the form
of this file is formed. But I can edit the XSD file)
When I tried to load the XML File into a dataset which has the corresponding
schema (XSD) assigned, an exception of “Invalid input string” is raise.
I investigated a lot, and I found that if the type of the element
guarantyPercent is String the problem don’t occurs, in another words: when
a XML element is in the form: <XXX/>, .net always load an empty string, and
for this reason failed when try to load into a decimal type. And .net doesn’t
indicate which XML element has the error.
My questions are the following:
- How can I manage the elements of this type: <xxxx/> with a decimal type.
(I tried with nillable, minOccurs attributes but nothing good happens, the
exception always raise)
- I am reading that .net classes that manage XML files don’t indicate which
XML element has the error, only report an error in general. How can I
validate de XML (without parsing manually) and I case of error indicate the
specific element that has the error.
Thanks so much…