Solved

Problem creating C# class file with XSD.exe for XML Schema

Posted on 2009-04-01
7
2,064 Views
Last Modified: 2013-11-10
Hi,

I am getting following error, when I try to run XSD.exe for a schema.

  - Error generating code for DataSet ''.
  - Unable to convert input xml file content to a DataSet. Undefined data type:
'token'.
  - Undefined data type: 'token'.

Can you please suggest what needs to be done to generate the class file for that schema?

I am looking for: 1) Other tool like XSD.exe which works fine. or 2) how to resolve the above error message for XSD.exe
0
Comment
Question by:meetpd
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 24048058
It sounds as if your schema is incorrect. Have you tried validating it with an XML Schema for XML Schemas?
0
 

Author Comment

by:meetpd
ID: 24048083
The schema is given by government agency. Hence we can safely assume it be to be correct.

0
 
LVL 27

Expert Comment

by:BigRat
ID: 24048152
OK, may I ask what schema it is or is that confidential? It is just that the word "token" is not defined, yet in schemas there is a construct called "#token" and it might just be that the # is missing.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:meetpd
ID: 24048182
I can share the file - no problem with that. Only thing is I am unable to upload it even after zipping it as it does not seem to allow XSD file.  Do you know better way to share that file for you to see?

0
 
LVL 27

Expert Comment

by:BigRat
ID: 24048304
Yes, E-mail it to me. My E-Mail is in the profile.
0
 

Author Comment

by:meetpd
ID: 24048368
Thanks!

I have send you an email for this. Email has subjectline: XML File Schema - As discussed on EE
0
 
LVL 27

Accepted Solution

by:
BigRat earned 250 total points
ID: 24048642
OK, I have looked at the schema and it is correct. The use of xs:token (A string that does not contain line feeds, carriage returns, tabs, leading or trailing spaces, or multiple spaces) is in fact in XML Schema 2001, but it seems that xsd.exe does not support it.

I have found this entry :-

http://bytes.com/groups/net-xml/177628-error-using-derived-simpletype-attribute-xsd-dataset

which reports the same problem. There he substituted xs:string for xs:token.  That's a work around for the moment.

I suggest that you download the latest .Net development set, since the problem might be resolved, although I can find no reference on the Microsoft site. This codeproject page shows the status of the various binders, which if you can't temporarily change the schema to get started, might help you to pick another tool. It is definitely a bug in xsd.exe.

http://www.codeproject.com/KB/cpp/XML_Data_Binding.aspx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now