排除xsd中的值 [英] Excluding values in the xsd

查看:90
本文介绍了排除xsd中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个XML,它指定了一个Cobol副本成员。根据XSD检查XML是否为


其中一个xml属性是Cobol字段名。 xsd约束

此属性的值大于零且小于31.

现在我想要包含另一个检查。该值不能是

Cobol保留字之一。所以我有一个带有保留字的列表(如SUM,

ACCEPT,COMPUTE等)。

如何在xsd中指定这个被排除的值,以便XML <如果其中一个保留字用于

属性值,则
vaidation将返回错误。

DickD

I have a XML which specifies a Cobol copybook member. The XML is
checked against a XSD.
One of the xml attributes is the Cobol fieldname. The xsd constraints
the value of this attribute to be greater then zero and less then 31.
Now I want to include another check. The value must not be one of the
Cobol reserved words. So I have a list with reserved words (like SUM,
ACCEPT, COMPUTE, etc).
How can I specify this excluded values in the xsd so that the XML
vaidation will return errors if one of the reserved words is used in
the attribute value.
DickD

推荐答案

di ********* @ donkeydevelopment.com 写道:

我有一个XML,它指定了一个Cobol字帖成员。根据XSD检查XML是否为


其中一个xml属性是Cobol字段名。 xsd约束

此属性的值大于零且小于31.

现在我想要包含另一个检查。该值不能是

Cobol保留字之一。所以我有一个带有保留字的列表(如SUM,

ACCEPT,COMPUTE等)。

如何在xsd中指定这个被排除的值,以便XML <如果其中一个保留字在

中使用属性值,则
vaidation将返回错误。
I have a XML which specifies a Cobol copybook member. The XML is
checked against a XSD.
One of the xml attributes is the Cobol fieldname. The xsd constraints
the value of this attribute to be greater then zero and less then 31.
Now I want to include another check. The value must not be one of the
Cobol reserved words. So I have a list with reserved words (like SUM,
ACCEPT, COMPUTE, etc).
How can I specify this excluded values in the xsd so that the XML
vaidation will return errors if one of the reserved words is used in
the attribute value.



您可以枚举这些保留字,例如

< xs:simpleType name =" reserved-word">

< xs:restriction base =" xs:string">

< xs:enumeration value =" ACCEPT" />

< ; xs:enumeration value =" COMPUTE" />

< xs:enumeration value =" SUM" />

<! - 进一步添加这里的值 - >

< / xs:restriction>

< / xs:simpleType>



-


Martin Honnen
http ://JavaScript.FAQTs.com/


di ********* @ donkeydevelopment.com 写道:

如何在xsd中指定此排除值,以便XML

vaidation如果在
$ b $中使用了一个保留字,则会返回错误b属性值。
How can I specify this excluded values in the xsd so that the XML
vaidation will return errors if one of the reserved words is used in
the attribute value.



使用正则表达式来描述属性的可接受值。

http://www.w3.org/TR/xmlschema-2/#rf-pattern
http://www.w3.org/TR/ xmlschema-2 / #regexs

-

Joe Kesselman /小心病人的愤怒。 - John Dryden

Use a regular expression to describe the attribute''s acceptable values.

http://www.w3.org/TR/xmlschema-2/#rf-pattern
http://www.w3.org/TR/xmlschema-2/#regexs
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden


Martin Honnen写道:
Martin Honnen wrote:
di ********* @ donkeydevelopment.com 写道:

>我有一个XML它指定了Cobol副本成员。根据XSD检查XML。
其中一个xml属性是Cobol fieldname。 xsd约束
此属性的值大于零且小于31.
现在我想要包含另一个检查。该值不能是Cobol保留字之一。所以我有一个带有保留字的列表(如SUM,
ACCEPT,COMPUTE等)。
如何在xsd中指定这个被排除的值,以便XML
vaidation将返回错误,如果其中一个保留字用于属性值。
>I have a XML which specifies a Cobol copybook member. The XML is
checked against a XSD.
One of the xml attributes is the Cobol fieldname. The xsd constraints
the value of this attribute to be greater then zero and less then 31.
Now I want to include another check. The value must not be one of the
Cobol reserved words. So I have a list with reserved words (like SUM,
ACCEPT, COMPUTE, etc).
How can I specify this excluded values in the xsd so that the XML
vaidation will return errors if one of the reserved words is used in
the attribute value.



您可以枚举这些保留字,例如


You can enumerate those reserved words e.g.



对不起,我误读了您的请求,如果您想要允许

所有保留字,枚举会有所帮助,但如果您想要禁止它们则不会。

-


Martin Honnen
http://JavaScript.FAQTs.com/


这篇关于排除xsd中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆