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

Error using ReadXmlSchema on a xsd file.

I am using some sample code from gotdotnet to Create DataSet mappings from a
xsd schema. I am geting this error. code and error below. I might mention
there is also a publictypelibrary file with this file I may have to use it in
some way. I am very new at XML so some examples or articles would be helpfull.


The error is:

Undefined complexType 'http://www.adsml.org/typelibrary/1.1:MLItemType' is
used as a base for complex type extension."
The code Is:
Imports System
Imports System.IO
Imports System.Xml

Partial Class _Default
Inherits System.Web.UI.Page
Dim myLoadSchema As String
Dim myXmlDataDocument As XmlDataDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

myLoadSchema = Request.MapPath("BookingsMain-AS.xsd")
'This file was also with this file Bookings-PublicTypeLibrary-AS.xsd
Run(myLoadSchema)

End Sub
Public Sub Run(ByVal args As String)
Try
myXmlDataDocument = New XmlDataDocument()
Response.Write("Creating an XmlDataDocument ...")
ParseSchema(args)
DisplayTableStructure()
Catch e As exception
Response.Write("Exception: " & e.ToString())
End Try
End Sub

' Loads a specified schema into the DataSet
Public Sub ParseSchema(ByVal schema As String)
Dim myStreamReader As StreamReader = Nothing
Try
myStreamReader = New StreamReader(schema)
Response.Write("Reading Schema file ...")

'*************
myXmlDataDocument.DataSet.ReadXmlSchema(myStreamRe ader)
'********Error is here in the ReadXmlSchema

Catch e As exception
Response.Write("Exception: " & e.ToString())

Finally
If Not myStreamReader Is Nothing Then
myStreamReader.Close()
End If

End Try
End Sub

' Displays the DataSet tables structure
Private Sub DisplayTableStructure()
Response.Write(" ")
Response.Write("Table structure")
Response.Write(" ")
Response.Write("Tables count=" &
myXmlDataDocument.DataSet.Tables.Count.ToString())

Dim i, j As Integer

For i = 0 To (myXmlDataDocument.DataSet.Tables.Count - 1)
Response.Write("TableName='" &
myXmlDataDocument.DataSet.Tables(i).TableName & "'.")
Response.Write("Columns count=" &
myXmlDataDocument.DataSet.Tables(i).Columns.Count. ToString())

For j = 0 To (myXmlDataDocument.DataSet.Tables(i).Columns.Count
- 1)
Response.Write(Strings.Chr(9) & "ColumnName='" &
myXmlDataDocument.DataSet.Tables(i).Columns(j).Col umnName & "', type = " &
myXmlDataDocument.DataSet.Tables(i).Columns(j).Dat aType.ToString())
Next
Response.Write(" ")
Next
End Sub
End Class

Thank you
--
Jerry
Aug 22 '06 #1
13 2856
Hi Jerry,

You're getting this error message, because your schema might be referencing
another one. This type is not defined in your schema. Could you please post
your schema content here. Or it will be better if you point me to the
gotdotnet URL for this code sample. Thanks!

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 23 '06 #2
Kevin,

Thank you for the reply.

I think you are correct about this schema referencing another file. There
are two files in the distribution. I have emailed you both of the files. One
of the files has typelibrary in the filename ( this is a clue). Now the
question is how do I use these files to create the dataset from the XSD files
since there are two files. I also think there may be a collection of schemas
in this file. How do I find out how this file is constructed.

Thank you
Jerry
--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

You're getting this error message, because your schema might be referencing
another one. This type is not defined in your schema. Could you please post
your schema content here. Or it will be better if you point me to the
gotdotnet URL for this code sample. Thanks!

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 23 '06 #3
keven,
Sorry I could not email you the files. online.microsoft.com gets bounced. If
you need the files please tell me how to send them to you.

Thank you,
--
Jerry
"Jerry C" wrote:
Kevin,

Thank you for the reply.

I think you are correct about this schema referencing another file. There
are two files in the distribution. I have emailed you both of the files. One
of the files has typelibrary in the filename ( this is a clue). Now the
question is how do I use these files to create the dataset from the XSD files
since there are two files. I also think there may be a collection of schemas
in this file. How do I find out how this file is constructed.

Thank you
Jerry
--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

You're getting this error message, because your schema might be referencing
another one. This type is not defined in your schema. Could you please post
your schema content here. Or it will be better if you point me to the
gotdotnet URL for this code sample. Thanks!

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Aug 23 '06 #4
Hi Jerry,

Is this a typed DataSet schema? As I assume, a typed DataSet schema is
always in one file. Not all xml schemas can be loaded as a DataSet schema.
You might need to combine them into one valid DataSet schema, since
DataSet.ReadXmlSchema can only read from one file/stream.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 24 '06 #5
Keven,

Thank you for the reply.

I am a little new at XML to know what kind of dataset this is there are
hundreds of lines of XSD in these files. I was hopping to understand how to
use these files to create datasets or what ever they were intended for. I
have found this post that talks about schemas and multiple files.

http://samples.gotdotnet.com/quickst...jectModel.aspx

I can email you the files and maybe you can give me some guidance about how
to use them. These files do open in dot.net 2005 and there is a graphical
display.

Thank you

--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

Is this a typed DataSet schema? As I assume, a typed DataSet schema is
always in one file. Not all xml schemas can be loaded as a DataSet schema.
You might need to combine them into one valid DataSet schema, since
DataSet.ReadXmlSchema can only read from one file/stream.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 24 '06 #6
Keven,

I am testing in asp.net 2005 using VB in case you needed that info.

There is a include and several Imports in the first part of the file XSD
file I wonder if the app is finding these files. I have them in the app dir
but these Namespace= "location" does not exists. How should these be in the
file so they will be found.

This is the text of the include and Imports
<xs:include schemaLocation="AdsMLBookings-1.0-PublicTypeLibrary-AS.xsd" />
<xs:import namespace="http://www.adsml.org/typelibrary/1.1"
schemaLocation="AdsMLTypeLibrary-1.1-AS.xsd" />
<xs:import namespace="http://www.adsml.org/controlledvocabularies/2.0"
schemaLocation="AdsMLControlledVocabularies-2.0-AS.xsd" />
<xs:import namespace="http://www.adsml.org/adsmlmaterials/1.0"
schemaLocation="AdsMLMaterials-1.0-PublicTypeLibrary-AS.xsd" />

Thank you
--
Jerry
"Jerry C" wrote:
Keven,

Thank you for the reply.

I am a little new at XML to know what kind of dataset this is there are
hundreds of lines of XSD in these files. I was hopping to understand how to
use these files to create datasets or what ever they were intended for. I
have found this post that talks about schemas and multiple files.

http://samples.gotdotnet.com/quickst...jectModel.aspx

I can email you the files and maybe you can give me some guidance about how
to use them. These files do open in dot.net 2005 and there is a graphical
display.

Thank you

--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

Is this a typed DataSet schema? As I assume, a typed DataSet schema is
always in one file. Not all xml schemas can be loaded as a DataSet schema.
You might need to combine them into one valid DataSet schema, since
DataSet.ReadXmlSchema can only read from one file/stream.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Aug 24 '06 #7
Hi Jerry,

If the files are in same directory, are the include and import tags
specifying the correct location for these files? Are all the files in that
folder? If so, and your code still doesn't work, please send these XSDs to
my mailbox. Remove 'online' from my nospam alias is my real email.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 25 '06 #8
Keven,

Thank you for the reply.

I think you are correct about the location of the files. The tags point to a
site that does not exist.

The namespace points to:
namespace="http://www.adsml.org/controlledvocabularies/2.0"
which does not exist. and the schemaLocation points to:
schemaLocation="AdsMLControlledVocabularies-2.0-AS.xsd" />
All the xsd files are in the app directory. The question now is do I use a
full path name for the xsd file in the namespace or schemaLocation or is the
path in the namespace and the xsd file name in the schemaLocation.

I will email you the files

Thank you,

--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

If the files are in same directory, are the include and import tags
specifying the correct location for these files? Are all the files in that
folder? If so, and your code still doesn't work, please send these XSDs to
my mailbox. Remove 'online' from my nospam alias is my real email.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 25 '06 #9
Hi Jerry,

I've received the schema file you sent me. The schema cannot be loaded, not
because the namespace points to an invalid site. The namespace is only a
string that gives a name. It can be any string actually.

After my research, I found a type named StructuredDescriptionsType was not
declared in your schema. It was used in file
AdsMLMaterials-1.0-PublicTypeLibrary-AS.xsd, but never declared anywhere.

<xs:element name="StructuredDescriptions"
type="adsml-sd:StructuredDescriptionsType" minOccurs="0" />

You need to contact the source of these .xsd files to check for this issue.
Let me know if anything is unclear.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 28 '06 #10
Kevin,

Thank you for the reply,

I think I have complicated the issue by not including all the files in the
distribution. There are imports and includes in all the files I sent you so
when I included all of them in the app dir the error you found went away and
I was back to the original one in my first post. I will email you all the
files.
--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

I've received the schema file you sent me. The schema cannot be loaded, not
because the namespace points to an invalid site. The namespace is only a
string that gives a name. It can be any string actually.

After my research, I found a type named StructuredDescriptionsType was not
declared in your schema. It was used in file
AdsMLMaterials-1.0-PublicTypeLibrary-AS.xsd, but never declared anywhere.

<xs:element name="StructuredDescriptions"
type="adsml-sd:StructuredDescriptionsType" minOccurs="0" />

You need to contact the source of these .xsd files to check for this issue.
Let me know if anything is unclear.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 28 '06 #11
Hi Jerry,

It seems that this XSD is not a valid DataSet schema. Not all XSD files can
be loaded as a DataSet. This is a really bit schema, and it is valid. But
it cannot be as a DataSet schema, because some types in it cannot be a
DataType in a DataTable.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 29 '06 #12
Kevin,

Thanks for the reply.

I am kind of new to XML. How would these files be used by asp.net to help
create XML files. Are there utilites to help format the XML to be correct for
these XSD files. some Links to articles would be helpfull

Thank you,
--
Jerry
"Kevin Yu [MSFT]" wrote:
Hi Jerry,

It seems that this XSD is not a valid DataSet schema. Not all XSD files can
be loaded as a DataSet. This is a really bit schema, and it is valid. But
it cannot be as a DataSet schema, because some types in it cannot be a
DataType in a DataTable.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 29 '06 #13
Hi Jerry,

XMLSpy is a widely used tool which provides this function to help your
create/validate xml files accroding to your schema. It also have a lot of
other functions for Xml. You can download to try it.

http://www.altova.com/products/xmlspy/xml_editor.html

Also, if you're developing an ASP.NET app, you can use an XmlReader to
validate your xml file. Here is a sample.

http://msdn2.microsoft.com/en-us/library/8f0h7att.aspx

HTH.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Aug 30 '06 #14

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

Similar topics

11
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the...
4
by: ElleEmme | last post by:
I everybody, when i try to load in a dataset an xml schema with ReadXmlSchema method, the framework validator throws an error. The schema is divide in 3 files. The main one "scheda_full.xsd"...
0
by: Pete | last post by:
I am trying to load a DataSet from an xml file that has 2 tables in it. Any help would be great. Here is the C# code snipit on how I load it. Instead of geting a dataset with 2 table I am...
0
by: Peter | last post by:
I have a problem. I create a file XSD "file1" that contains simpletypes and complextypes, generate the dll, import the dll in a different XSD "file2" (of an other project). In a DataSet validate...
0
by: Justin | last post by:
Greetings All, I'm trying to use the ReadXmlSchema method to define a DataSet before using the ReadXml method, and am receiving the following error: Type...
1
by: David Bartosik [MSFT MVP] | last post by:
I am writing an xml file from a dataset. I don't want the xml file to use the table names, I don't want the schema inferred from the dataset. Because of this I created an xsd to provide an explicit...
1
by: Ed West | last post by:
vs2005 final release, um, i can't open my typed dataset, I am getting unhelpful error. I could not find any info on it on newsgroups or web sites. anyone know of a solution? Seems to be...
9
by: PeterWellington | last post by:
I have a column in a data table that stores enum values and assigns a default value: Dim dc As New DataColumn("TestEnumField", GetType(DayOfWeek)) dc.DefaultValue = DayOfWeek.Thursday When I...
3
by: Eric | last post by:
Help! I created a XML schema with a Visual Studio tools. I'm filling a dataset with a DataAdapter. Before I use the "WriteXml" method to write the data to a xml file, I want to map the XSD file I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.