public final class Parser extends Object
| Constructor and Description |
|---|
Parser(File file)
Create a new non-coalescing parser with the specified input file.
|
Parser(File file,
boolean coalescing,
boolean namespaceAware)
Create a new parser with the specified input file.
|
Parser(InputStream in)
Create a new non-coalescing parser with the specified input stream.
|
Parser(InputStream in,
boolean coalescing,
boolean namespaceAware)
Create a new parser with the specified input stream
and the coalescing property.
|
| Modifier and Type | Method and Description |
|---|---|
Locale |
chooseLocale(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 |
getColumnNumber() |
String |
getCurName() |
String |
getCurURI() |
String |
getCurValue() |
EntityResolver |
getEntityResolver()
Returns the object used to resolve entities
|
int |
getLineNumber() |
Locale |
getLocale()
Returns the diagnostic locale.
|
String |
getPublicId() |
String |
getSystemId() |
boolean |
isFastStandalone()
Returns true if standalone documents skip processing of
all external DTD information.
|
int |
parse()
Parse and return the next parsing state.
|
void |
setEntityResolver(EntityResolver r)
Lets applications control entity resolution.
|
void |
setFastStandalone(boolean value)
Setting this flag enables faster processing of valid standalone
documents: external DTD information is not processed, and no
attribute normalization or defaulting is done.
|
void |
setLocale(Locale l)
Used by applications to request locale for diagnostics.
|
public Parser(InputStream in, boolean coalescing, boolean namespaceAware)
in - the input stream.coalescing - the parser will coalesce character data
if, and only if, this parameter is truenamespaceAware - the parser will support namespaces if, and only if,
this parameter is truepublic Parser(InputStream in)
in - the input stream.public Parser(File file, boolean coalescing, boolean namespaceAware) throws IOException
file - the input file.coalescing - the parser will coalesce character data
if, and only if, this parameter is truenamespaceAware - the parser will support namespaces if, and only if,
this parameter is trueIOExceptionpublic Parser(File file) throws IOException
file - the input file.IOExceptionpublic void setLocale(Locale l) throws ParseException
l - The locale to use, or null to use system defaults
(which may include only message IDs).ParseException - If no diagnostic messages are available
in that locale.public Locale getLocale()
public String getCurName()
public String getCurURI()
public String getCurValue()
public int getLineNumber()
public int getColumnNumber()
public String getPublicId()
public String getSystemId()
public Locale chooseLocale(String[] languages) throws ParseException
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.ParseExceptionMessageCatalogpublic void setEntityResolver(EntityResolver r)
public EntityResolver getEntityResolver()
public void setFastStandalone(boolean value)
For documents which are declared as standalone, but which are not valid, a fatal error may be reported for references to externally defined entities. That could happen in any nonvalidating parser which did not read externally defined entities. Also, if any attribute values need normalization or defaulting, it will not be done.
public boolean isFastStandalone()
public int parse()
throws ParseException,
IOException
ParseExceptionIOExceptionCopyright © 2017–2019 Eclipse Foundation. All rights reserved.