• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

I want to check xml against dtd.

aceO07

Diamond Member
I want to check large files to make sure they are formatted correctly and all the tags are properly closed. The files are in xml, but it is hard to check manually since they are mainly attributes within elements. It's <item <element1 <att 'afasf'>><blah <foo 'afh'> <bar 'agh'>>>.. etc. It would be much easier to check if it was like this <element1> <att 'afasf'> </element1>. Unfortunately, that is the way it is. So I'm looking for something that can check the files against a DTD file.

If the code was in Java or Ruby, that'd be great. Anything else is fine as well. I definitely refer something free.
 
Yes there are a number of validating XML parsers written in Java out there. In fact as of Java 2 standard edition 1.4 and later they started making making this ability part of the standard Java distribution. Just look at the API specification and you will see Java packages such as javax.xml.parsers and javax.xml.transform. . .

There are a number of java xml projects over at Apache too. . .just go check out xml.apache.org
 
Don't forget that there are tons of editors and utilities already written that will do this for you. No need to actually program unless you want to do something custom.

I have an old copy of Xerces-C sitting here, for example, which is a free XML parser that ships with a command line utility for just this purpose:
C:\Class\csi662\hw3>StdInParse -v=always -n -f -s < h3p3-valid1.xml
stdin: 20 ms (31 elems, 8 attrs, 106 spaces, 116 chars)

C:\Class\csi662\hw3>StdInParse -v=always -n -f -s < h3p3-invalid1.xml
Error at (file stdin, line 13, char 57): Duplicate unique value declared for identity constraint of
element 'project'.

Not to mention I could just open the file in XMLSpy (not free, but has an evaluation) or Eclipse (mine validates XML and even offers lists of valid elements in auto-complete, although it might be from a plugin).
 
Back
Top