You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Mallaiyasamy, Sivakumar" <sm...@atg.com> on 2008/03/27 02:21:49 UTC

How to identify the document type (XML Schema and DTD document)?

Hi All,

 

I am parsing and/or merging an xml file document/s. The xml documents
could be of DTD or schema type. I got the parsing part working. While
reading the xml file, I want to use different entity parser based on the
document type. If the xml file is DTD type document, then I want to use
EntityResolverA and if the xml file is XML Schema type, then I want to
use the EntityResolverB.

 

How can we find the xml file type before invoking/using the parser or
before calling the entity resolver? I do not want to pass in additional
parameters in the command prompt to identify the xml file is of type DTD
or schema.

 

I am using JDK 5.0 which is using Xerces 2.6.2.

 

Thanks,

Sivakumar