How do I identify the document type of an XML document?

Submitted by: Administrator
If the XML document has a Public ID, then that is its document type. For example, if an XML document contains the following DOCTYPE declaration:
<!DOCTYPE mydoc PUBLIC "My public ID String"
"http://foo.com/url/to/my/dtd">

then its document type is My public ID String.

If the DOCTYPE declaration does not contain a Public ID, but specifies a System ID, then the document type is the System ID. For example, in the following DOCTYPE declaration:
<!DOCTYPE mydoc SYSTEM "http://foo.com/url/to/my/dtd">
the document type is http://foo.com/url/to/my/dtd.
Note: The System ID is of the DTD, not of the XML document itself. It can, however, still be used as a way to identify the XML document.
If the XML document does not specify a DOCTYPE declaration, then the document type can be either the root element name or the namespace URI, if it has one.
Submitted by: Administrator

Read Online BEA Weblogic Job Interview Questions And Answers