我可以在DTD模式中使用正则表达式吗?
我想强制执行XML元素必须包含ISBN代码。因此,我需要您的典型模式“ [0-9] {3} - [0-9] {3} ......
在DTD模式中可以实现吗?我读过,您不能将DTD与正则表达式结合在一起,但我不太确定。
I want to enforce that an XML element has to contain an ISBN code. Therefore, I need your typical pattern "[0-9]{3}-[0-9]{3}......".
Could that be achieved in a DTD schema? I've read you can't combine a DTD with regular expressions, but I'm not so sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您无法用DTD定义正则表格。
您可以执行带有XSD schemas 的正等式模式。
另一个选项是应用某种其他验证,例如 schematron 。
No, you can't define regex patterns with DTD.
You can enforce regex patterns with XSD schemas.
Another option is applying some sort of other validation, such as Schematron.