问题标签 [xsd.exe]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1927 浏览

.net - 使用替换组从 xsd.exe 生成的代码序列化的 XML 无效(无效 xsi:type 错误)

我已经从一些 3GPP XSD(多个 XSD 文件/命名空间)生成了一些 C# 类,除了替换组中使用的抽象类型的具体实例的一个问题之外,它非常适合序列化。

首先,架构的相关部分:

(genericNrm.xsd)

(eutran.xsd)

从包含 ENBFunction 的简单 ManagedElement 序列化的 XML 是:

内置的 Visual Studio XML 验证会抱怨该元素,指出“这是一个无效的 xsi:type 'http://www.3gpp.org/ftp/specs/archive/32_series/32.765#eutranNrm:ENBFunction'。

那么是序列化的 XML 错误还是验证错误?它与单独的名称空间有关吗?

我可以很好地反序列化 XML,但我需要生成的 XML 符合模式(不更改模式)。我发现如果我手动将 XML 更改为以下内容,错误就会消失(而且我发现它也更容易阅读):

我可以强制序列化器以这种方式输出吗?

谢谢你看...

0 投票
3 回答
1136 浏览

f# - XSD.EXE to generate F# Classes off of XSD

I am trying to use the tool XSD.EXE to generate some class files from an XSD. Whether there is anything to be gained from the resulting files is another question, but I would like to see what is generated. I found this reference, which notes:

Which, thanks to Luke over on the F# Visual Studio team, means I can do this:

Which is splendid. I don't have the same version of the code dom - so looking at the GAC I changed the line to:

Which yields:

C:\Users\Desktop\CSharpSamples\ResearchUploader\Fc-RixmlLib>xsd.exe RIXML-datatypes-2_3_1.xsd /classes /l:"Microsoft.FSharp.Compiler.CodeDom.FSharpCodePr ovider, FSharp.Compiler.CodeDom, Version=2.0.0,0, Culture=neutral, PublicKeyToken=a19089b1c74d0809" Microsoft (R) Xml Schemas/DataTypes support utility [Microsoft (R) .NET Framework, Version 4.0.30319.1] Copyright (C) Microsoft Corporation. All rights reserved. Error: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

If you would like more help, please type "xsd /?".

Thoughts?

0 投票
1 回答
293 浏览

.net - XSD 生成的类在反序列化后不包含 XInclude 内容

我正在使用 XmlSerializer 类从 XML 文档反序列化 XSD.exe 生成的类。XML 文档有两个指向其他 XML 文档的 XInclude 标记。反序列化后,XInclude 内容丢失。

有谁知道 .NET XML 解析器是否处理 XInclude 内容?如果没有,任何建议的解决方法?

谢谢。

0 投票
1 回答
233 浏览

.net - XML 嵌套属性和 XSD.exe

我遇到了一个问题,我试图构建一个代理类,但 XML 模式具有嵌套属性。这是关于该问题的论坛帖子 - .NET Nested Attributes,但我想知道是否没有更简单的方法来做到这一点?任何帮助表示赞赏。

韦德

0 投票
2 回答
29672 浏览

c# - 使用 xsd.exe 生成 c# 文件,出现错误和警告

这是我正在运行的命令:

这些是我得到的错误:

XSD 文件是从以下文档的附录 A 中复制/粘贴的: http ://services.eoportal.org/portal/documents/06-141r2_Ordering_Services_for_Earth_Observation_Products_0.9.2.pdf

0 投票
1 回答
3205 浏览

c# - 需要默认访问器:自定义配置部分

我完全被一个简单的 Microsoft 错误消息弄糊涂了。

当我针对包含自定义 ConfigurationSection 的程序集运行 XSD.exe 时(该程序集又使用自定义 ConfigurationElement 和自定义 ConfigurationElementCollection 以及多个 ConfigurationProperties),我收到以下错误消息:

错误:处理“Olbert.Entity.Utils.dll”时出错。

  • 反映类型“Olbert.Entity.DatabaseConnection”时出现错误。
  • 您必须在 System.Configuration.ConfigurationLockCollection 上实现默认访问器,因为它继承自 ICollection。

然而,有问题的类有一个默认访问器:

我意识到上面没有做任何事情,但我不需要通过索引访问元素的属性。我只是想解决错误消息。

发生什么了?

0 投票
2 回答
3354 浏览

.net - xsd 错误:对路径的访问被拒绝

我正在尝试使用 xsd 工具更新 xml 架构。运行它的脚本如下所示:

@ECHO 关闭

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\xsd.exe" ArchiveServiceConfiguration.xsd /classes /language:CS /namespace:"SI.ArchiveService.CommonLogic.ArchiveServiceConfiguration"

暂停

但是以用户和管理员身份运行时都会出现写入错误。有什么建议么?我可能会补充一点,旧文件在团队资源管理器中处于源代码控制之下。

D:\AK2\ArchiveService\CommonLogicModule\SI.ArchiveService.CommonLogic.ArchiveServiceConfiguration>xsd.exe ArchiveServiceConfiguration.xsd /classes /language:CS /namespace:"SI.ArchiveService.CommonLogic.ArchiveServiceConfiguration"

Microsoft (R) Xml Schemas/DataTypes 支持实用程序 [Microsoft (R) .NET Framework,版本 2.0.50727.1432] 版权所有 (C) Microsoft Corporation。版权所有。

写入文件“D:\AK2\ArchiveService\CommonLogicModule\SI.ArchiveService.CommonLogic.ArchiveServiceConfiguration\ArchiveServiceConfiguration.cs”。

错误:为架构“ArchiveServiceConfiguration”生成类时出错。- 拒绝访问路径“D:\AK2\ArchiveService\CommonLogicModule\SI.ArchiveService.CommonLogic.ArchiveServiceConfiguration\ArchiveServiceConfiguration.cs”。

如果您需要更多帮助,请输入“xsd /?”。

0 投票
1 回答
1053 浏览

c# - LINQ-to-XML 中 XSD.EXE 的替代方案?

LINQ-to-XML 能否以通用方式使用以实现 XSD.EXE 的意图,从而避免使用 XSD.EXE

0 投票
1 回答
572 浏览

visual-studio-2008 - VB中使用XSD生成的类读取XML示例

我使用 Visual Studio 中的 XSD.exe 实用程序生成了一个 Visual Basic 类。我想知道是否有人有您如何在 Visual Basic 中处理数据的示例。MSDN 上的例子很差。将我指向示例代码,即使在 Csharp 中,也可以。

0 投票
2 回答
3255 浏览

xml - 如何使用 XML 架构定义工具 (Xsd.exe)

说真的,我很困惑。我有一个由类制成的 .XSD,以便我可以传递给 Web 服务。它把它作为一个 XMLSchema 对象传递给 web 服务,现在我需要将它变成一个类,以便我可以在 web 服务端用它制作对象。我知道 XSD.exe 是答案,但如果我能确切地弄清楚如何实现这个东西,我会被诅咒的。我需要它在运行时进行此转换,因此我需要将它的代码放入我的项目中,并且我看到的所有使用 XSD.exe 的参考都谈到从命令行调用它。我的 .XSD 在下面。

在我的项目中,它存在于 XMLSchema 对象中。我如何把它变成一个类?

- 非常感谢您提供的任何帮助。