Methods Summary |
---|
public void | comment(char[] buf, int off, int len) if (lexicalHandler != null) lexicalHandler.comment (buf, off, len);
|
public void | endCDATA() if (lexicalHandler != null) lexicalHandler.endCDATA ();
|
public void | endDTD() if (lexicalHandler != null) lexicalHandler.endDTD ();
|
public void | endDocument() pending.clear (); super.endDocument ();
|
public void | endElement(java.lang.String u, java.lang.String l, java.lang.String q) --count; super.endElement (u, l, q);
|
public void | endEntity(java.lang.String name) if (lexicalHandler != null) lexicalHandler.endEntity (name);
|
public int | getColumnNumber() return (locator == null) ? -1 : locator.getColumnNumber ();
|
public int | getLineNumber() return (locator == null) ? -1 : locator.getLineNumber ();
|
public java.lang.String | getPublicId() return (locator == null) ? null : locator.getPublicId ();
|
public java.lang.String | getSystemId() return (locator == null) ? null : locator.getSystemId ();
|
public void | parse(org.xml.sax.InputSource in)
XMLReader parent = getParent ();
if (parent != null)
parent.setProperty (lexicalID, this);
super.parse (in);
|
public void | processingInstruction(java.lang.String target, java.lang.String data)
if ("XInclude".equals (target)) {
// this should do full XML Base processing
// instead we just handle relative and absolute URLs
try {
URL url = new URL (getSystemId ());
url = new URL (url, data.trim ());
data = url.toString ();
} catch (Exception e) {
throw new SAXParseException (
"XInclude, can't use URI: " + data, locator, e);
}
xinclude (data);
} else
super.processingInstruction (target, data);
|
public void | setDocumentLocator(org.xml.sax.Locator l)
locator = l;
super.setDocumentLocator (this);
|
public void | setProperty(java.lang.String uri, java.lang.Object handler)
if (lexicalID.equals (uri))
lexicalHandler = (LexicalHandler) handler;
else
super.setProperty (uri, handler);
|
public void | startCDATA() if (lexicalHandler != null) lexicalHandler.startCDATA ();
|
public void | startDTD(java.lang.String root, java.lang.String publicId, java.lang.String systemId) if (lexicalHandler != null) lexicalHandler.startDTD (root, publicId, systemId);
|
public void | startDocument() pending.addElement (locator.getSystemId ()); super.startDocument ();
|
public void | startElement(java.lang.String u, java.lang.String l, java.lang.String q, org.xml.sax.Attributes a) count++; super.startElement (u, l, q, a);
|
public void | startEntity(java.lang.String name) if (lexicalHandler != null) lexicalHandler.startEntity (name);
|
private void | xinclude(java.lang.String uri)
XMLReader helper;
Scrubber scrubber;
if (count == 0)
throw new SAXParseException (
"XInclude, illegal location", locator);
if (pending.contains (uri))
throw new SAXParseException (
"XInclude, circular inclusion", locator);
// start with another parser acting just like us
helper = XMLReaderFactory.createXMLReader ();
helper.setEntityResolver (this);
helper.setErrorHandler (this);
// Set up the proxy locator and event filter.
scrubber = new Scrubber (locator, this);
locator = null;
scrubber.setContentHandler (this);
helper.setContentHandler (scrubber);
helper.setProperty (lexicalID, scrubber);
// we INTEND to discard DTDHandler and DeclHandler events
// Merge the included document, except its DTD
try {
pending.addElement (uri);
helper.parse (uri);
} catch (java.io.IOException e) {
SAXParseException err;
ErrorHandler handler;
err = new SAXParseException (uri, locator, e);
handler = getErrorHandler ();
if (handler != null)
handler.fatalError (err);
throw err;
} finally {
pending.removeElement (uri);
}
|