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

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

      1. 在 C# 中,如何确定元素的 XSD 定义的 MaxLength

        时间:2023-06-04
          • <bdo id='HY7mR'></bdo><ul id='HY7mR'></ul>

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

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

            • <tfoot id='HY7mR'></tfoot>
              • <legend id='HY7mR'><style id='HY7mR'><dir id='HY7mR'><q id='HY7mR'></q></dir></style></legend>
                  <tbody id='HY7mR'></tbody>

                  本文介绍了在 C# 中,如何确定元素的 XSD 定义的 MaxLength的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用带有附加 XSD 的 XmlReader 进行验证.

                  I'm using XmlReader with an attached XSD for validation.

                  在读取和验证我的 XML 文档时,我想在我的 C# 代码中确定 XSD 中为特定元素指定的maxLength"值.例如,我的 XSD 片段非常简单地定义为:

                  As my XML document is being read and validated, I want to determine in my C# code the 'maxLength' value specified in the XSD for a particular element. For example, my XSD fragment is very simply defined as:

                  <xsd:element name="testing" minOccurs="0">
                      <xsd:simpleType>
                          <xsd:restriction base="xsd:string">
                              <xsd:maxLength value="10"/>
                          </xsd:restriction>
                      </xsd:simpleType>
                  </xsd:element>
                  

                  我可以使用以下方法轻松获得minOccurs"值:

                  I can get the 'minOccurs' value easily using:

                  myReader.SchemaInfo.SchemaElement.MinOccurs;
                  

                  但是我如何获得maxLength"值(在我上面的示例片段中的值为 10)???

                  But how do I get the 'maxLength' value (value of 10 in my example fragment above)???

                  我认为myReader.SchemaInfo.SchemaElement.Constraints"可能会给我这些信息,但该集合的计数"始终为零.

                  I thought 'myReader.SchemaInfo.SchemaElement.Constraints' might give me this information, but that collection always has a 'Count' of zero.

                  谢谢,

                  拍拍

                  推荐答案

                  你会在这里找到:在文档验证期间访问 XML 模式信息 很好地解释了如何做到这一点 &更多.

                  you'll find here:Accessing XML Schema Information During Document Validation a good explanation of how to do this & more.

                  这篇关于在 C# 中,如何确定元素的 XSD 定义的 MaxLength的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:从 XSD 生成 SQL Server DB 下一篇:如何在 c# .net CF 3.5 中使用 XmlDocument 向 xml 添加属

                  相关文章

                  最新文章

                      <bdo id='3YizL'></bdo><ul id='3YizL'></ul>
                  1. <small id='3YizL'></small><noframes id='3YizL'>

                  2. <legend id='3YizL'><style id='3YizL'><dir id='3YizL'><q id='3YizL'></q></dir></style></legend>
                    <i id='3YizL'><tr id='3YizL'><dt id='3YizL'><q id='3YizL'><span id='3YizL'><b id='3YizL'><form id='3YizL'><ins id='3YizL'></ins><ul id='3YizL'></ul><sub id='3YizL'></sub></form><legend id='3YizL'></legend><bdo id='3YizL'><pre id='3YizL'><center id='3YizL'></center></pre></bdo></b><th id='3YizL'></th></span></q></dt></tr></i><div id='3YizL'><tfoot id='3YizL'></tfoot><dl id='3YizL'><fieldset id='3YizL'></fieldset></dl></div>

                      <tfoot id='3YizL'></tfoot>