What resources can I use to validate a DTD?

喜你入骨 提交于 2019-12-06 03:36:16

问题


What resources are available to validate a DTD? I want to be clear: I am not talking about validating XML documents against a DTD.

I am talking about making sure that the DTD itself is valid.


回答1:


I work with Oxygen xml editor, you can try for 30 day trial! Works very well with xml files, dtd, xslt... When you write DTD code you can validate it (document menu > validate). The dtd file is an xml file which describe a xml file.
This code:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT chapter (title, paragraph)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT paragraph (#PCDATA)>

are valid. This code:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT chapter (title, paragraph)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT paragraph (strong)>

give an alert. hope it work for you




回答2:


You are able to validate DTD files using the eclipse java IDE. I realise it is not a lightweight solution, however I found it useful whilst working with DTDs which would eventually be compiled to Java classes via xjc.

To do this you can load the .dtd file in eclipse (copy it into a project, or point your project towards your dtd file). Then in the file navigator in eclipse, you can right click on the dtd, then click validate.

For documentation see the Eclipse official website




回答3:


I found a solution. Validome is a free, online DTD and Schema validator. It does not require me to sign up for any trials, or install any frameworks or other software in order to validate a DTD. Hope this helps someone else. Cheers.



来源:https://stackoverflow.com/questions/18984426/what-resources-can-i-use-to-validate-a-dtd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!