一起学习
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?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?How do I create my own DTD?
阅读(140) | 评论(0) | 转发(0) |