Methods Summary |
---|
public org.xml.sax.ContentHandler | getContentHandler()
return this.contentHandler;
|
public org.xml.sax.DTDHandler | getDTDHandler()Always returns null.
return null;
|
public org.xml.sax.EntityResolver | getEntityResolver()
return entityResolver;
|
public org.xml.sax.ErrorHandler | getErrorHandler()
return errorHandler;
|
public boolean | getFeature(java.lang.String name)
if (name == null) {
throw new NullPointerException("name");
}
if (name.equals(Feature.VALIDATION)) {
return false;
}
if (name.equals(Feature.NAMESPACES)) {
return processNamespaces;
}
if (name.equals(Feature.NAMESPACE_PREFIXES)) {
return processNamespacePrefixes;
}
if (name.equals(Feature.STRING_INTERNING)) {
return true;
}
throw new SAXNotRecognizedException(name);
|
public org.xml.sax.ext.LexicalHandler | getLexicalHandler()Returns the current lexical handler.
return lexicalHandler;
|
public java.lang.Object | getProperty(java.lang.String name)
if (name == null) {
throw new NullPointerException("name");
}
if (name.equals(LEXICAL_HANDLER_PROPERTY)) {
return lexicalHandler;
}
throw new SAXNotRecognizedException(name);
|
public boolean | isNamespaceProcessingEnabled()Returns true if this SAX parser processes namespaces.
return processNamespaces;
|
public void | parse(org.xml.sax.InputSource input)
if (processNamespacePrefixes == processNamespaces) {
/*
* Expat has XML_SetReturnNSTriplet, but that still doesn't
* include xmlns attributes like this feature requires. We may
* have to implement namespace processing ourselves if we want
* this (not too difficult). We obviously "support" namespace
* prefixes if namespaces are disabled.
*/
throw new SAXNotSupportedException("The 'namespace-prefix' " +
"feature is not supported while the 'namespaces' " +
"feature is enabled.");
}
// Try the character stream.
Reader reader = input.getCharacterStream();
if (reader != null) {
try {
parse(reader, input.getPublicId(), input.getSystemId());
} finally {
// TODO: Don't eat original exception when close() throws.
reader.close();
}
return;
}
// Try the byte stream.
InputStream in = input.getByteStream();
String encoding = input.getEncoding();
if (in != null) {
try {
parse(in, encoding, input.getPublicId(), input.getSystemId());
} finally {
// TODO: Don't eat original exception when close() throws.
in.close();
}
return;
}
String systemId = input.getSystemId();
if (systemId == null) {
throw new SAXException("No input specified.");
}
// Try the system id.
in = ExpatParser.openUrl(systemId);
try {
parse(in, encoding, input.getPublicId(), systemId);
} finally {
in.close();
}
|
private void | parse(java.io.Reader in, java.lang.String publicId, java.lang.String systemId)
ExpatParser parser = new ExpatParser(
ExpatParser.CHARACTER_ENCODING,
this,
processNamespaces,
publicId,
systemId
);
parser.parseDocument(in);
|
private void | parse(java.io.InputStream in, java.lang.String encoding, java.lang.String publicId, java.lang.String systemId)
ExpatParser parser = new ExpatParser(
encoding,
this,
processNamespaces,
publicId,
systemId
);
parser.parseDocument(in);
|
public void | parse(java.lang.String systemId)
parse(new InputSource(systemId));
|
public void | setContentHandler(org.xml.sax.ContentHandler handler)
this.contentHandler = handler;
|
public void | setDTDHandler(org.xml.sax.DTDHandler ignored)Not implemented.
logger.warning("DTD handlers aren't supported.");
|
public void | setEntityResolver(org.xml.sax.EntityResolver resolver)
this.entityResolver = resolver;
|
public void | setErrorHandler(org.xml.sax.ErrorHandler handler)
this.errorHandler = handler;
|
public void | setFeature(java.lang.String name, boolean value)
if (name == null) {
throw new NullPointerException("name");
}
if (name.equals(Feature.VALIDATION)) {
if (value) {
throw new SAXNotSupportedException("Cannot enable " + name);
} else {
// Default.
return;
}
}
if (name.equals(Feature.NAMESPACES)) {
processNamespaces = value;
return;
}
if (name.equals(Feature.NAMESPACE_PREFIXES)) {
processNamespacePrefixes = value;
return;
}
if (name.equals(Feature.STRING_INTERNING)) {
if (value) {
// Default.
return;
} else {
throw new SAXNotSupportedException("Cannot disable " + name);
}
}
throw new SAXNotRecognizedException(name);
|
public void | setLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)Registers a lexical event handler. Supports neither
{@link LexicalHandler#startEntity(String)} nor
{@link LexicalHandler#endEntity(String)}.
If the application does not register a lexical handler, all
lexical events reported by the SAX parser will be silently
ignored.
Applications may register a new or different handler in the
middle of a parse, and the SAX parser must begin using the new
handler immediately.
this.lexicalHandler = lexicalHandler;
|
public void | setNamespaceProcessingEnabled(boolean processNamespaces)Enables or disables namespace processing. Set to true by default. If you
enable namespace processing, the parser will invoke
{@link ContentHandler#startPrefixMapping(String, String)} and
{@link ContentHandler#endPrefixMapping(String)}, and it will filter
out namespace declarations from element attributes.
this.processNamespaces = processNamespaces;
|
public void | setProperty(java.lang.String name, java.lang.Object value)
if (name == null) {
throw new NullPointerException("name");
}
if (name.equals(LEXICAL_HANDLER_PROPERTY)) {
// The object must implement LexicalHandler
if (value instanceof LexicalHandler) {
this.lexicalHandler = (LexicalHandler) value;
return;
}
throw new SAXNotSupportedException("value doesn't implement " +
"org.xml.sax.ext.LexicalHandler");
}
throw new SAXNotRecognizedException(name);
|