File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes xml validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml validation" Watch "xml validation" New topic

xml validation

Sanjay. Kulkarni.

Joined: Jan 02, 2012
Posts: 4

Assuming my xml is as :
<note id="501">
<body>Don't forget me this weekend!</body>
<note id="502">
<heading>Re: Reminder</heading>
<body>I will not</body>

I would like to create dtd/schema for that. Also would like to validate that xml using DOM. Please suggest
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

The Ranch's own XML FAQ page links to several resources about validating XML via DTD or schema.
Sanjay. Kulkarni.

Joined: Jan 02, 2012
Posts: 4
Hi Paul,

Thanks for your reply.
Is there any way to validate xml (find missing tags, improper tags, and the special characters) without using any of dtd or xsd.
Please help with java example for the above.
Tim Moores

Joined: Sep 21, 2011
Posts: 2415
Validation implies the presence of some form of schema (DTD, XSD, Relax-NG). But it sounds as if you want to check whether an XML document is wellformed instead. Simply parse the XML and see if an exception happens.
I agree. Here's the link:
subject: xml validation
It's not a secret anymore!