xml - 最小长度在下面的代码中不起作用。当我为 Name 提供空白值时,它通过了模式验证(它应该抛出错误)
问题描述
最小长度在下面的代码中不起作用。当我为 FirstName 提供空白值时,它会通过 SOAP UI 中的模式验证(它应该抛出错误)。
<xsd:element minOccurs="1" name="FirstName" default="John" >
<xsd:simpleType>
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd:enumeration value="John"/>
<xsd:enumeration value="Kyle"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
</xsd:element>
解决方案
它通过了验证,因为当您为元素提供空值时,有效值是默认值“John”,它对类型有效。
推荐阅读
- node.js - 当手动使用新模型()时,是否可以在保存()之前修改文档,使用猫鼬更新运算符?
- python - Python将列表列表中的数据添加到数据框自己的行中
- python - python map减少具有完全相同元音的单词
- javascript - 当我尝试加载 css 样式表时出现快速 MIME 错误
- sql - 分组连续时间戳(红移)
- python - 使用 aws ssm 执行带有参数的 python 脚本
- python - Python 可执行文件可以创建文件吗?
- java - 如何在 Java 中使用 ConsoleIO 制作评分程序(***No Scanner***)
- react-native - react-native-multiselect-view - 将容器渲染为“按下”
- php - 从 Google Sheet API 获取单元格格式