Package com.sun.msv.scanner.dtd
Class DTDParser
java.lang.Object
com.sun.msv.scanner.dtd.DTDParser
This implements parsing of XML 1.0 DTDs.
This conforms to the portion of the XML 1.0 specification related
to the external DTD subset.
For multi-language applications (such as web servers using XML
processing to create dynamic content), a method supports choosing
a locale for parser diagnostics which is both understood by the
message recipient and supported by the parser.
This parser produces a stream of parse events. It supports some
features (exposing comments, CDATA sections, and entity references)
which are not required to be reported by conformant XML processors.
- Author:
- David Brownell, Janet Koenig, Kohsuke KAWAGUCHI
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchooseLocale
(String[] languages) Chooses a client locale to use for diagnostics, using the first language specified in the list that is supported by this parser.int
Returns the handler used to for DTD parsing events.Returns the object used to resolve entitiesint
Returns the diagnostic locale.void
Parse a DTD.void
parse
(InputSource in) Parse a DTD.void
setDtdHandler
(DTDEventListener handler) Used by applications to set handling of DTD parsing events.void
Lets applications control entity resolution.void
Used by applications to request locale for diagnostics.
-
Field Details
-
TYPE_CDATA
- See Also:
-
TYPE_ID
- See Also:
-
TYPE_IDREF
- See Also:
-
TYPE_IDREFS
- See Also:
-
TYPE_ENTITY
- See Also:
-
TYPE_ENTITIES
- See Also:
-
TYPE_NMTOKEN
- See Also:
-
TYPE_NMTOKENS
- See Also:
-
TYPE_NOTATION
- See Also:
-
TYPE_ENUMERATION
- See Also:
-
declaredElements
-
-
Constructor Details
-
DTDParser
public DTDParser()
-
-
Method Details
-
setLocale
Used by applications to request locale for diagnostics.- Parameters:
l
- The locale to use, or null to use system defaults (which may include only message IDs).- Throws:
SAXException
-
getLocale
Returns the diagnostic locale. -
chooseLocale
Chooses a client locale to use for diagnostics, using the first language specified in the list that is supported by this parser. That locale is then set using setLocale(). Such a list could be provided by a variety of user preference mechanisms, including the HTTP Accept-Language header field.- Parameters:
languages
- Array of language specifiers, ordered with the most preferable one at the front. For example, "en-ca" then "fr-ca", followed by "zh_CN". Both RFC 1766 and Java styles are supported.- Returns:
- The chosen locale, or null.
- Throws:
SAXException
- See Also:
-
setEntityResolver
Lets applications control entity resolution. -
getEntityResolver
Returns the object used to resolve entities -
setDtdHandler
Used by applications to set handling of DTD parsing events. -
getDtdHandler
Returns the handler used to for DTD parsing events. -
parse
Parse a DTD.- Throws:
IOException
SAXException
-
parse
Parse a DTD.- Throws:
IOException
SAXException
-
getPublicId
-
getSystemId
-
getLineNumber
public int getLineNumber() -
getColumnNumber
public int getColumnNumber()
-