【问题标题】:xsd.exe code generator alternatives that can associate elements with simpleType restrictions可以将元素与 simpleType 限制相关联的 xsd.exe 代码生成器替代方案
【发布时间】:2012-09-06 17:50:34
【问题描述】:

我的 XSD 架构结合了以下限制和元素

<?xml version="1.0" encoding="UTF-8"?>
...
<xsd:simpleType name="dollar11neg">
  <xsd:restriction base="xsd:string">
    <xsd:pattern value="-?\d?\d?\d?\d?\d?\d?\d?\d\.\d\d"/>
  </xsd:restriction>
</xsd:simpleType>

<xsd:element name="Price" type="dollar11neg"/>

<xsd:element name="Item">
  <xsd:complexType>
    <xsd:sequence>
       <xsd:element ref="Price" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>
...

XSD.exe 不会生成限制。我想知道是否有人知道可以生成包含限制的类的工具。

这样做的目的是,在序列化期间或之前,如果字段的值格式不正确(缺少小数位),我可以实现逻辑来查看值所需的格式,并根据模式限制。

而且我不想手动查看整个 xsd 架构来找出每个字段的模式以及对模式进行硬编码。

【问题讨论】:

    标签: c# .net xml xsd


    【解决方案1】:

    试试 XMLSPY 工具。

    here 提供 30 天免费试用。

    【讨论】:

    • 感谢您的回复。我实际上更喜欢免费的解决方案,因为我会不断地这样做,因为架构会不时更新。感谢您的快速回复!
    猜你喜欢
    • 2018-04-19
    • 2014-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-12
    • 2010-10-02
    • 1970-01-01
    相关资源
    最近更新 更多