Arun wrote:
I need to take either a DTD/XSD (preferably a DTD), and use it as a
schema to process an XML file.
Can someone tell me the best way to do so?
With Sun JDK 1.5 there is a special package
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/package-summary.html>
for validating against a schema (XSD for example).
DTD validation is different as a DTD is supposed to be linked in from
the XML instance via the
<!DOCTYPE root-element SYSTEM "whatever.dtd">
there all you need to do with Sun JDK 1.4 or later is to use an
appropriate factory (e.g. SAXParserFactory or DocumentBuilderFactory)
from javax.xml.parsers and call setValidating(true).
--
Martin Honnen
http://JavaScript.FAQTs.com/