<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
You need to use the XML Declaration Syntax (very simple: declaration keywords begin with
It says that there shall be an element called Shopping-List and that it shall contain elements called Item: there must be at least one (that's the plus sign) but there may be more than one. It also says that the Item element may contain parsed character data (PCDATA, ie text).
Because there is no other element which contains Shopping-List, that element is assumed to be the `root' element, which encloses everything else in the document. You can now use it to create an XML file: give your editor the declarations:
(assuming you put the DTD in that file). Now your editor will let you create files according to the pattern:
Chocolate
Sugar
Butter
It is possible to develop complex and powerful DTDs of great subtlety, but for any significant use you should learn more about document systems analysis and document type design. See for example Developing SGML DTDs by Maler and el Andaloussi, Prentice Hall, 1997, 0-13-309881-8, which was written for SGML, but perhaps 95% of it applies to XML as well, as XML is much simpler than full SGML -- see the list of restrictions which shows what has been cut out.
How do I create my own DTD?
最新推荐文章于 2025-12-04 19:14:36 发布
本文介绍如何使用XML声明语法定义文档类型定义(DTD),并详细解释了DTD的组成部分及如何利用它来创建符合规范的XML文件。通过示例说明了如何定义元素及其结构,为读者提供了一个创建XML文件的基础。
9081

被折叠的 条评论
为什么被折叠?



