<tfoot id='KJ8Fj'></tfoot>
    1. <i id='KJ8Fj'><tr id='KJ8Fj'><dt id='KJ8Fj'><q id='KJ8Fj'><span id='KJ8Fj'><b id='KJ8Fj'><form id='KJ8Fj'><ins id='KJ8Fj'></ins><ul id='KJ8Fj'></ul><sub id='KJ8Fj'></sub></form><legend id='KJ8Fj'></legend><bdo id='KJ8Fj'><pre id='KJ8Fj'><center id='KJ8Fj'></center></pre></bdo></b><th id='KJ8Fj'></th></span></q></dt></tr></i><div id='KJ8Fj'><tfoot id='KJ8Fj'></tfoot><dl id='KJ8Fj'><fieldset id='KJ8Fj'></fieldset></dl></div>

        <bdo id='KJ8Fj'></bdo><ul id='KJ8Fj'></ul>

      1. <legend id='KJ8Fj'><style id='KJ8Fj'><dir id='KJ8Fj'><q id='KJ8Fj'></q></dir></style></legend>

        <small id='KJ8Fj'></small><noframes id='KJ8Fj'>

      2. 如何创建在属性值验证方面不同的 XSD?

        时间:2023-06-07
        <i id='cRT1E'><tr id='cRT1E'><dt id='cRT1E'><q id='cRT1E'><span id='cRT1E'><b id='cRT1E'><form id='cRT1E'><ins id='cRT1E'></ins><ul id='cRT1E'></ul><sub id='cRT1E'></sub></form><legend id='cRT1E'></legend><bdo id='cRT1E'><pre id='cRT1E'><center id='cRT1E'></center></pre></bdo></b><th id='cRT1E'></th></span></q></dt></tr></i><div id='cRT1E'><tfoot id='cRT1E'></tfoot><dl id='cRT1E'><fieldset id='cRT1E'></fieldset></dl></div>
        <tfoot id='cRT1E'></tfoot>
        • <bdo id='cRT1E'></bdo><ul id='cRT1E'></ul>
        • <small id='cRT1E'></small><noframes id='cRT1E'>

          • <legend id='cRT1E'><style id='cRT1E'><dir id='cRT1E'><q id='cRT1E'></q></dir></style></legend>

                  <tbody id='cRT1E'></tbody>

                  本文介绍了如何创建在属性值验证方面不同的 XSD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我已经搜索了一段时间,得出的结论是可能无法更改每个属性值的验证.

                  I have been searching for a while now, and came to the conclusion it may not be possible to change the validation per value of an attribute.

                  例如我有两个action"节点,都有一个type"属性和两个元素(name"和description")

                  For example I have two "action" nodes, both with a "type" attribute and two elements ("name" and "description")

                  仅当type"属性的值为1"时,它有一个带有abc"子元素的a"元素,当type"属性为2"时,它有一个带有的"元素bla"然而"子元素.

                  Only when the value of the "type" attribute is "1" it has an "a" element with "abc" child elements and when the "type" attibute is "2" it has a "bla" element with "yet" child elements.

                  类型 1 的示例

                  <action type="1">
                    <name>yup</name>
                    <description>yyy</description>
                    <a>
                      <abc>false</abc>
                    </a>
                  </action>
                  

                  类型 2 的示例

                  <action type="2">
                    <name>yup2</name>
                    <description>RRR</description>
                    <bla>
                      <yet />
                    </bla>
                  </action>
                  

                  我想创建一个 XSD* 来检查这两种类型,这可能吗?如果是这样,如何?

                  I want to create one XSD* who whould check both types, is this possible? And if so, how?

                  • 它必须是一个 XSD,因为我想将 XSD 放在 MSSQL 数据库表的 XML 列上.

                  推荐答案

                  您说得对,XSD 1.0 是不可能的,它是 MSSQL 支持的唯一 XSD 版本.你能得到的最好的方法是在 abla 之间创建一个选择,也许对属性 type 值等进行一些限制.下面是一个插图.

                  You are right, it is not possible with XSD 1.0 which is the only XSD version supported by MSSQL. The best you can get is to create a choice between a and bla, maybe place some constraints on attribute type values, etc. Below is an illustration.

                  <?xml version="1.0" encoding="utf-8"?>
                  <!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
                  <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                    <xs:element name="action">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="name" type="xs:string" />
                          <xs:element name="description" type="xs:string" />
                          <xs:choice>     
                              <xs:element name="a">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="abc" type="xs:boolean" />
                                  </xs:sequence>
                                </xs:complexType>
                              </xs:element>
                              <xs:element name="bla">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="yet" type="xs:anyType" />
                                  </xs:sequence>
                                </xs:complexType>
                              </xs:element>
                          </xs:choice>
                        </xs:sequence>
                        <xs:attribute name="type" type="xs:unsignedByte" use="required" />
                      </xs:complexType>
                    </xs:element>
                  </xs:schema>
                  

                  如果您控制 XML 结构,并且仍然想使用某些属性来控制内容模型,那么 xsi:type 是 XSD 1.0 中唯一的方法.

                  If you control the XML structure, and still want to use some attribute to control the content model, then xsi:type is the only way to do it in XSD 1.0.

                  这篇关于如何创建在属性值验证方面不同的 XSD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:来自一个透视表的 SQL FOR XML 多级 下一篇:将数据从 XML 文件导入 MySQL 数据库

                  相关文章

                  最新文章

                  <i id='K07ip'><tr id='K07ip'><dt id='K07ip'><q id='K07ip'><span id='K07ip'><b id='K07ip'><form id='K07ip'><ins id='K07ip'></ins><ul id='K07ip'></ul><sub id='K07ip'></sub></form><legend id='K07ip'></legend><bdo id='K07ip'><pre id='K07ip'><center id='K07ip'></center></pre></bdo></b><th id='K07ip'></th></span></q></dt></tr></i><div id='K07ip'><tfoot id='K07ip'></tfoot><dl id='K07ip'><fieldset id='K07ip'></fieldset></dl></div>
                      <bdo id='K07ip'></bdo><ul id='K07ip'></ul>
                  1. <tfoot id='K07ip'></tfoot>

                      <legend id='K07ip'><style id='K07ip'><dir id='K07ip'><q id='K07ip'></q></dir></style></legend>

                      <small id='K07ip'></small><noframes id='K07ip'>