在xsd文件上使用ReadXmlSchema时出错。 [英] Error using ReadXmlSchema on a xsd file.

查看:80
本文介绍了在xsd文件上使用ReadXmlSchema时出错。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gotdotnet中的一些示例代码来创建来自

xsd架构的DataSet映射。我正在解决这个错误。代码和错误如下。我可能会提到

还有一个带有这个文件的publictypelibrary文件,我可能不得不以某种方式在

中使用它。我是XML的新手,所以一些例子或文章会有所帮助。



错误是:


Undefined complexType' 'http://www.adsml.org/typelibrary/1.1:MLItemType''是

用作复杂类型扩展的基础。

代码是:

进口系统

进口System.IO

进口System.Xml


部分类_Default

继承System.Web.UI.Page

将myLoadSchema调暗为字符串

将myXmlDataDocument调暗为XmlDataDocument

受保护的子页面_Load (ByVal sender As Object,ByVal e As

System.EventArgs)处理Me.Load


myLoadSchema = Request.MapPath(" BookingsMain-AS.xsd" ;)

''此文件也包含此文件Bookings-PublicTypeLibrary-AS.xsd

运行(myLoadSchema)


结束子

公共子运行(ByVal args为字符串)

尝试

myXmlDataDocument =新的XmlDataDocument ()

Response.Write(" Creating a XmlDataDocument ...")

ParseSchema(args)

DisplayTableStructure()

Catch e As exception

Response.Write(" Exception:" &安培; e.ToString())

结束尝试

结束子


''将指定的模式加载到DataSet中
Public Sub ParseSchema(ByVal schema As String)

Dim myStreamReader As StreamReader = Nothing

尝试

myStreamReader = New StreamReader(架构)

Response.Write(阅读架构文件......)


''*********** **

myXmlDataDocument.DataSet.ReadXmlSchema(myStreamRe ader)

''******** ReadXmlSchema中的错误

>
Catch e As exception

Response.Write(" Exception:"& e.ToString())


最后

如果不是myStreamReader则没有那么

myStreamReader.Close()

结束如果


结束尝试< br $>
End Sub


''显示DataSet表格结构

Private Sub DisplayTableStructure()

回复.Write("")

Response.Write(" Tabl e结构)

Response.Write(" ")

Response.Write(" Tables count ="&

myXmlDataDocument.DataSet.Tables.Count.ToString())


Dim i,j作为整数


对于i = 0 To(myXmlDataDocument.DataSet.Tables.Count - 1)

响应。写(TableName =''"&

myXmlDataDocument.DataSet.Tables(i).TableName&"''。")

响应。写(列计数="&

myXmlDataDocument.DataSet.Tables(i).Columns.Count。ToString())


对于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("")

下一页

End Sub

En d班级


谢谢

-

Jerry

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

推荐答案

嗨Jerry,


您收到此错误消息,因为您的架构可能正在引用

另一个。您的架构中未定义此类型。您能在这里发布

您的架构内容吗?或者,如果您指向此代码示例的

gotdotnet网址会更好。谢谢!


Kevin Yu

Microsoft在线社区支持


========== ========================================

获取通知通过电子邮件到我的帖子?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。

注意:MSDN托管新闻组支持服务适用于非紧急问题

,可以在1个工作日内收到社区或Microsoft支持工程师的初步回复。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx

======================================== ==========


(此帖子按原样提供,不作任何保证,并且不授予

权利。 )

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.)


Kevin,


感谢您的回复。


我认为你对引用另一个文件的模式是正确的。

是发行版中的两个文件。我已经通过电子邮件向您发送了这两个文件。一个

的文件在文件名中有typelibrary(这是一个线索)。现在

问题是如何使用这些文件从XSD文件创建数据集

,因为有两个文件。我也认为这个文件中可能有一组模式

。我怎么知道这个文件是如何构建的。


谢谢

Jerry

-

Jerry

" Kevin Yu [MSFT]"写道:
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:

您好Jerry,


您收到此错误消息,因为您的架构可能正在引用

另一个。您的架构中未定义此类型。您能在这里发布

您的架构内容吗?或者,如果您指向此代码示例的

gotdotnet网址会更好。谢谢!


Kevin Yu

Microsoft在线社区支持


========== ========================================

获取通知通过电子邮件到我的帖子?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。

注意:MSDN托管新闻组支持服务适用于非紧急问题

,可以在1个工作日内收到社区或Microsoft支持工程师的初步回复。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx

======================================== ==========


(此帖子按原样提供,不作任何保证,并且不授予

权利。 )

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.)


keven,

抱歉,我无法通过电子邮件将这些文件发送给您。 online.microsoft.com被退回。如果您需要这些文件,请告诉我如何将这些文件发送给您。


谢谢,

-

Jerry

" Jerry C"写道:
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,


感谢您的回复。


我认为你对这个引用另一个文件的模式是正确的。

是发行版中的两个文件。我已经通过电子邮件向您发送了这两个文件。一个

的文件在文件名中有typelibrary(这是一个线索)。现在

问题是如何使用这些文件从XSD文件创建数据集

,因为有两个文件。我也认为这个文件中可能有一组模式

。我怎么知道这个文件是如何构建的。


谢谢

Jerry

-

Jerry


" Kevin Yu [MSFT]"写道:
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:

您好Jerry,


您收到此错误消息,因为您的架构可能正在引用

另一个。您的架构中未定义此类型。您能在这里发布

您的架构内容吗?或者,如果您指向此代码示例的

gotdotnet网址会更好。谢谢!


Kevin Yu

Microsoft在线社区支持


========== ========================================

获取通知通过电子邮件到我的帖子?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。

注意:MSDN托管新闻组支持服务适用于非紧急问题

,可以在1个工作日内收到社区或Microsoft支持工程师的初步回复。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx

======================================== ==========


(此帖子按原样提供,不作任何保证,并且不授予

权利。 )
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.)


这篇关于在xsd文件上使用ReadXmlSchema时出错。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆