Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What resources can I use to validate a DTD?

Tags:

xml

dtd

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.

like image 547
Tarzan Avatar asked Sep 24 '13 14:09

Tarzan


People also ask

How do you validate a DTD?

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.

What validates the XML document against the DTD?

An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is both "Well Formed" and "Valid".

What are the needs for DTD?

The purpose of a DTD is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements. A DTD can be declared inline in your XML document, or as an external reference.


Video Answer


2 Answers

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

like image 99
Joshua Cole Avatar answered Oct 05 '22 14:10

Joshua Cole


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

like image 26
steguozzo Avatar answered Oct 05 '22 12:10

steguozzo