473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Decimal Type in a XSD Schema and problems with DataAdapter

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…

Nov 12 '05 #1
1 1530
For empty elements that are not of type xs:string or derived from it, you
need to use xsi:nil in the instance (along with nillable="true" specified
for the element in the schema) if you want the empty elements to valdiate
against the schema.

In the schema:
<element name="guarantyPercent" type="decimal" nillable="true"/>

in the instance:
< guarantyPercent xsi:nil="true"/>

If you are using .NET 1.1 and the XmlValidatingReader to validate the xml
against the schema, the XmlSchemaException raised during validation should
have the LineNumber and LinePosition of the error.

Thanks,
Priya

"Andres" <An****@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
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.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Binesh Bannerjee | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. In another thread, Martin Honnen <mahotrash@yahoo.de> wrote: > XHTML is XML so there is no problem to use it inside of an XML document e.g. > ...
1
by: Ted | last post by:
I have some code which processes an xsd. For elements of type xs:integer the XmlSchemaDatatype object gotten from the schema elements ElementType member contains a ValueType of System.Decimal. I...
3
by: Saso Zagoranski | last post by:
Hi! A question about database tables... I have a SELECT statement: SELECT something FROM someTable WHERE code = @code The parameter code starts with 1 and is autoincremented... Now I want...
0
by: Dica | last post by:
i'm getting an error when trying set my dataAdapter's selectCommand. the sqlStatement is a storedProc which takes parameters, so it's constructed as: sqlSelectCommand1.CommandText = ""; ...
1
by: jmarr02s | last post by:
I am trying to change my Amount column Data Type from Integer to Decimal (precision 9 digits, scale 3, that is 6 digits to the left of decimal and 3 digits to the right of decimal. Here is the...
3
by: DustWolf | last post by:
Hello, I am wondering, what is the standard for including decimal numbers in XML code? What determines what is the decimal delimiter and what can be the grouping symbol? I have just realized...
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i noticed if i use the missing schema to fill a datatablecollection the table names are generic (Table, Table1, Table2) is there anyway to change that? i tried on the sql side to use an...
12
by: Frank Millman | last post by:
Hi all I have a standard requirement for a 'decimal' type, to instantiate and manipulate numeric data that is stored in a database. I came up with a solution long before the introduction of the...
17
by: D'Arcy J.M. Cain | last post by:
I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? True...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.