English 中文(简体)
产生 Nest型,而不是使用xsd.exe的全球型号
原标题:Generate Nested Types instead of Global Types with xsd.exe

在C#类中使用xsd.exe,是否有办法用 Nest型号而不是全球型号生产一个xsd的文档?

我想利用SSIS-Sql服务器一体化服务公司这一xsd文档,而SSIS看不出我Xsd的好像。

我愿以 Nest型号制作这样的轴:

  <?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Country">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="City">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="CityName" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="CoutryName" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

但xsd.exe生产这一产品,有全球类型,SSIS没有读到。 我需要人工改变这一xsd。

 <?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Country">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="City" type="City">
        </xs:element>
        <xs:element name="CoutryName" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="City">
    <xs:sequence>
      <xs:element name="CityName" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>

任何建议? 或者我可以使用的其他工具。

Thanks a lot.

最佳回答

I ll further assume that not "very well" means you re not seeing CountryName in your XML Source output. The documentation on MSDN is a good reading, although in my opinion it fails to describe why you would encounter the behavior you see.

我认为,它必须采用XML来源产出的确定方式。 SSIS引述了XML结构的数据集;顶级实体,即与基本要素相对应的,没有被描绘成产出,因此,在你的国家,与其相关的所有特性都不会显示。

证明这一点的最容易的方法是添加另一个根基元素,总结贵国的情况(相当于拥有国家类型财产的“my”类别)。

<xs:element name="root">
    <xs:complexType>
        <xs:sequence>
            <xs:element ref="Country"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

如果在你的图谱中添加上述图形碎片,你应取得预期结果。 在一开始,我就认为,它必须处理以下所述问题:here;尽管你仍然可以使用上述MSDN链接所描述的数据集视像,但就你而言,作者风格是你所建议的(主要是

问题回答

暂无回答




相关问题
How to validate DataTable with XML Schema?

Does anyone know how to validate a DataTable against a particular DataTable XSD (Schema)? Which would be the best performance-optimized way of doing this? For example: <?xml version="1.0" ...

Deprecated XML validation code problem C#

I m trying to figure out how to correct his deprecated xml schema validation code. public static bool ValidateXml(string xmlFilename, string schemaFilename) { ⁞ //Forward stream reading ...

Getting an object representation of an .XSD file in Java

What is the easiest way to obtain a statically typed representation of an XML schema (.XSD) in Java? More specifically I want to be able to programatically traverse all defined simpleType:s and ...

xmlserializer validation

I m using XmlSerializer to deserialize Xml achives. But I found the class xsd.exe generated only offers capability to read the xml, but no validation. For example, if one node is missing in a document,...

regex for four-digit numbers (or "default")

I need a regex for four-digit numbers separated by comma ("default" can also be a value). Examples: 6755 3452,8767,9865,8766,3454 7678,9876 1234,9867,6876,9865 default Note: "default" ...