我们可以在DTD中放置值的正则表达式吗? [英] Can we put regular expression for a value in a DTD?

查看:72
本文介绍了我们可以在DTD中放置值的正则表达式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否存在一种将正则表达式与属性值相关联的方法.就像在XML模式中一样:

I would like to know if there is a way to associate regular expression for the value of an attribute. like in XML Schema:

 <xs:pattern value="([0-9]|[A-Z]){3}" />

使DTD与该XML行匹配:

to make the DTD match with this XML line:

<airport iata="LAE" name="Nadzab Airport" city="Nadzab" country="Papua New Guinea">

推荐答案

否,DTD不支持正则表达式.使用XSD进行非常出色的数据键入.

No, DTDs do not support regex. Use XSD for vastly superior datatyping.

DTD属性值可以是枚举,但是:

DTD attribute values can be enumerations, however:

<!ELEMENT airport EMPTY>
<!ATTLIST airport iata (LAE|LAX|LGA) #IMPLIED>

这篇关于我们可以在DTD中放置值的正则表达式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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