473,322 Members | 1,347 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,322 software developers and data experts.

Help: XML and Schema

44
Hi everybody! I´m getting the error "The value of the element is invalid - The value '' is invalid according to its datatype 'Integer' " (I´m using Visual Studio 2005). How can a xsd element be either empty (like the empty string "") or an integer ???

Would be most thankfull for any help!

Best regards
Aug 12 '07 #1
4 1432
jkmyoung
2,057 Expert 2GB
2 possible ways I can think of.

1. use nil
a. Change schema to have attribute nillable="true"
b. In source, add xsi:nil="true" to the empty element.

2. base this value on an xs:string, and use a pattern.
Expand|Select|Wrap|Line Numbers
  1. <xs:simpleType>
  2.     <xs:restriction base="xs:string">
  3.         <xs:pattern value="[0-9]*"/>
  4.     </xs:restriction>
  5. </xs:simpleType>
Aug 13 '07 #2
zeny
44
2 possible ways I can think of.

1. use nil
a. Change schema to have attribute nillable="true"
b. In source, add xsi:nil="true" to the empty element.

2. base this value on an xs:string, and use a pattern.
Expand|Select|Wrap|Line Numbers
  1. <xs:simpleType>
  2.     <xs:restriction base="xs:string">
  3.         <xs:pattern value="[0-9]*"/>
  4.     </xs:restriction>
  5. </xs:simpleType>
The second case obviously works, but the first one, although it´s perfectly logical, doesnt work! Can anyone tell why???
Aug 13 '07 #3
jkmyoung
2,057 Expert 2GB
You might have to define the xmlns:xsi namespace in the source as well.
Aug 14 '07 #4
Make the type a union between an empty string and xs:integer.
Aug 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mike | last post by:
Hello, I'm trying to understand how to map hierarchical XML data to relational database tables, but I seem to be missing something. I'm not a database expert, but I know the basics. XML seems...
3
by: johnsocs | last post by:
All - I am very stuck on building a schema for the following xml message. I feel I'm very close as the message validates if I remove the...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
2
by: Vagabond Software | last post by:
I have translated a DTD to an XML Schema (XSD) file by hand, and the Schema View in Visual Studio .NET 2003 seems to diplay everything properly. However, when I specify the schemalocation in my...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
1
by: Leepe | last post by:
example: I have a skill object that implements the XmlSerializable interface Implementing the getschema gives me some unwanted generations towards the wsdl.exe Reference.cs generation. skill is...
0
by: comic_rage | last post by:
Hi, I need to use C# to print the xml schema root <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://www.ciber.com/myfile" xmlns="http://www.ciber.com/myfile"...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
0
by: S Wheeler | last post by:
Hi All - I am creating a upgrade utility that transfers an bin / exe image over an xml stream. But I can not seem to get the deserialization of the binary field to work correctly. What I have is...
9
by: Tony Girgenti | last post by:
Hello I developed and tested a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form. I tried doing this without any help, but i'm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.