471,075 Members | 980 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 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 2699
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by ElleEmme | last post: by
reply views Thread by Peter | last post: by
reply views Thread by Justin | last post: by
1 post views Thread by David Bartosik [MSFT MVP] | last post: by
reply views Thread by leo001 | last post: by

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.