469,306 Members | 1,901 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Checking XML DTD syntax and validating XML

Does anyone know of a decent tool, preferably free, that will check and validate DTD syntax, to make sure that my DTD is correct?

The only tool that I have found thus far is the IBM visual DTD tool, which I do like, but is limited. Basically, your DTD is "good" when it parses... and I am not sure this is the best way to do it.

As for validation of XML, I have found a great tool, xmlvalid, here:
< http://www.elcel.com/products/xmlvalid.html >
Cliff
Jul 20 '05 #1
8 10085
Hi Cliff

xmlspy from altova is contains a DTD validator. Xmlspy is an excellent tool.
Unfortunately it is not free, however you may download a 30day trial from
their website.

/Sebastian www.tomac.se

"Clifford W. Racz" <ra*******@verizon.net> wrote in message
news:10*************@corp.supernews.com...
Does anyone know of a decent tool, preferably free, that will check and validate DTD syntax, to make sure that my DTD is correct?
The only tool that I have found thus far is the IBM visual DTD tool, which I do like, but is limited. Basically, your DTD is "good" when it parses...
and I am not sure this is the best way to do it.
As for validation of XML, I have found a great tool, xmlvalid, here:
< http://www.elcel.com/products/xmlvalid.html >
Cliff

Jul 20 '05 #2
Sebastian Tomac wrote:
xmlspy from altova is contains a DTD validator. Xmlspy is an excellent tool.
Unfortunately it is not free, however you may download a 30day trial from
their website.


You can get a free copy - the entry level "home" version at
http://www.altova.com/download_spy_home.html

Ghee
Jul 20 '05 #3
http://xmlvalidation.com should work, too, and for free.

Rainer
Ghee <gh*******@yahoo.co.uk> wrote in message news:<2i************@uni-berlin.de>...
Sebastian Tomac wrote:
xmlspy from altova is contains a DTD validator. Xmlspy is an excellent tool.
Unfortunately it is not free, however you may download a 30day trial from
their website.


You can get a free copy - the entry level "home" version at
http://www.altova.com/download_spy_home.html

Ghee

Jul 20 '05 #4
Thanks Rainer, but that only validates XML files, not DTD syntax checking.
Clifford

Rainer Typke wrote:
http://xmlvalidation.com should work, too, and for free.

Rainer

Jul 20 '05 #5
If you refer to a DTD in a checked XML document, the XML validator
asks you to upload that as well and also validates it, if I am not
mistaken.

Cheers,

Rainer

"Clifford W. Racz" <ra*******@verizon.net> wrote in message news:<10*************@corp.supernews.com>...
Thanks Rainer, but that only validates XML files, not DTD syntax checking.
Clifford

Rainer Typke wrote:
http://xmlvalidation.com should work, too, and for free.

Rainer

Jul 20 '05 #6
Oh, I see.

The tool does validate an uploaded XML Schema against the XML Schema definition (again, another schema).

The tool does not check DTD Syntax though. It treats it like and XSD and fails on the first entity.

Thanks though for the comment.
Rainer Typke wrote:
If you refer to a DTD in a checked XML document, the XML validator
asks you to upload that as well and also validates it, if I am not
mistaken.

Cheers,

Rainer

Jul 20 '05 #7
"Clifford W. Racz" <ra*******@verizon.net> wrote in message news:<10************@corp.supernews.com>...
....
The tool does validate an uploaded XML Schema against the XML Schema definition (again, another schema).

The tool does not check DTD Syntax though. It treats it like and XSD and fails on the first entity.

....

Well, you can't upload and check a DTD directly. But there is a way of
forcing the tool to actually perform a DTD syntax check: just write an
XML file that does nothing except for referring to your DTD and upload
it. The tool will then prompt you for the DTD, you can upload it in a
second step, and if there is a syntax error in your DTD, you will get
an error message. If the DTD is correct but your dummy XML file does
not conform to it, that fact will be reported after any errors in the
DTD.

This works for both DTDs and XSDs.

You can test this workaround by using an error-free pair of an XML and
DTD file (for example the files I will attach below), then insert a
syntax error in the DTD (for example, change an ATTLIST into an
ATLIST). The tool will then report that syntax error.

Hope this clears it up. I see that it would be a nice future feature
for the site to also offer syntax checks for DTD files without XML
files, so you are not forced to do that workaround.

Rainer

XML file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE personnel SYSTEM "personal.dtd">
<personnel>

<person id="Big.Boss">
<name><family>Boss</family> <given>Big</given></name>
<email>ch***@foo.com</email>
<link subordinates="one.worker two.worker three.worker four.worker
five.worker"/>
</person>

<person id="one.worker">
<name><family>Worker</family> <given>One</given></name>
<email>on*@foo.com</email>
<link manager="Big.Boss"/>
</person>

<person id="two.worker">
<name><family>Worker</family> <given>Two</given></name>
<email>tw*@foo.com</email>
<link manager="Big.Boss"/>
</person>

<person id="three.worker">
<name><family>Worker</family> <given>Three</given></name>
<email>th***@foo.com</email>
<link manager="Big.Boss"/>
</person>

<person id="four.worker">
<name><family>Worker</family> <given>Four</given></name>
<email>fo**@foo.com</email>
<link manager="Big.Boss"/>
</person>

<person id="five.worker">
<name><family>Worker</family> <given>Five</given></name>
<email>fi**@foo.com</email>
<link manager="Big.Boss"/>
</person>

</personnel>
DTD:

<?xml encoding="UTF-8"?>
<!ELEMENT personnel (person)+>

<!ELEMENT person (name,email*,url*,link?)>
<!ATTLIST person id ID #REQUIRED>
<!ATTLIST person note CDATA #IMPLIED>
<!ATTLIST person contr (true|false) 'false'>
<!ATTLIST person salary CDATA #IMPLIED>

<!ELEMENT name ((family,given)|(given,family))>

<!ELEMENT family (#PCDATA)>

<!ELEMENT given (#PCDATA)>

<!ELEMENT email (#PCDATA)>

<!ELEMENT url EMPTY>
<!ATTLIST url href CDATA 'http://'>

<!ELEMENT link EMPTY>
<!ATTLIST link manager IDREF #IMPLIED>
<!ATTLIST link subordinates IDREFS #IMPLIED>

<!NOTATION gif PUBLIC '-//APP/Photoshop/4.0' 'photoshop.exe'>
Jul 20 '05 #8
Rainer,
Ahh... I see what you are saying. This is effectively verifying syntax by failing if it doesn't parse in the XML validator. And, if it fails to parse, it throws an error and passes that along.

That is what I am doing now to check my DTDs. If this is the best I can do without spending hundreds of dollars on a program, then so be it. It always helps to have another data point...
Thanks,
Clifford

Rainer Typke wrote:
....

Well, you can't upload and check a DTD directly. But there is a way of
forcing the tool to actually perform a DTD syntax check: just write an
XML file that does nothing except for referring to your DTD and upload
it. The tool will then prompt you for the DTD, you can upload it in a
second step, and if there is a syntax error in your DTD, you will get
an error message. If the DTD is correct but your dummy XML file does
not conform to it, that fact will be reported after any errors in the
DTD.

This works for both DTDs and XSDs.

Jul 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Philip D Heady | last post: by
5 posts views Thread by Tongu? Yumruk | last post: by
2 posts views Thread by George Sakkis | last post: by
23 posts views Thread by Carter Smith | last post: by
10 posts views Thread by Samir | last post: by
8 posts views Thread by Dooglo | last post: by
3 posts views Thread by gaston.gloesener | last post: by
3 posts views Thread by w.m.gardella.sambeth | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.