Methods Summary |
---|
private void | addMarker(java.lang.String label, java.lang.String uri)
AttributesImpl atts = new AttributesImpl ();
if (locator != null && locator.getSystemId () != null)
uri = locator.getSystemId ();
// guard against InputSource objects without system IDs
if (uri == null)
throw new SAXParseException ("Entity URI is unknown", locator);
// guard against illegal relative URIs (Xerces)
try { new URL (uri); }
catch (IOException e) {
throw new SAXParseException ("parser bug: relative URI", locator);
}
atts.addAttribute (xmlNamespace, "base", "xml:base", "CDATA", uri);
current = new StackEntry ("", "", label, atts, current);
|
public void | attributeDecl(java.lang.String element, java.lang.String name, java.lang.String type, java.lang.String mode, java.lang.String defaultValue)
|
public void | comment(char[] buf, int off, int len)
|
public void | elementDecl(java.lang.String name, java.lang.String model)
|
public void | endCDATA()
|
public void | endDTD()
|
public void | endDocument() current = null;
|
public void | endElement(java.lang.String namespace, java.lang.String local, java.lang.String name) current = current.parent;
|
public void | endEntity(java.lang.String name) current = current.parent;
|
public void | externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
if (name.charAt (0) == '%")
return;
// absolutize URL
try {
URL url = new URL (locator.getSystemId ());
systemId = new URL (url, systemId).toString ();
} catch (IOException e) {
// what could we do?
}
extEntities.put (name, systemId);
|
public java.net.URL | getBaseURI()
return getBaseURI (current);
|
private java.net.URL | getBaseURI(XStack$StackEntry here)
String uri = null;
while (uri == null && here != null) {
uri = here.atts.getValue (xmlNamespace, "base");
if (uri != null)
break;
here = here.parent;
}
// marker for document or entity boundary? absolute.
if (here.qName.charAt (0) == '#")
return new URL (uri);
// else it might be a relative uri.
int offset = uri.indexOf (":/");
if (offset == -1 || uri.indexOf (':") < offset)
return new URL (getBaseURI (here.parent), uri);
else
return new URL (uri);
|
public java.lang.String | getInheritedAttribute(java.lang.String uri, java.lang.String name)
String retval = null;
boolean useNS = (uri != null && uri.length () != 0);
for (StackEntry here = current;
retval == null && here != null;
here = here.parent) {
if (useNS)
retval = here.atts.getValue (uri, name);
else
retval = here.atts.getValue (name);
}
return retval;
|
public void | internalEntityDecl(java.lang.String name, java.lang.String value)
|
public void | setDocumentLocator(org.xml.sax.Locator l) locator = l;
|
public void | startCDATA()
|
public void | startDTD(java.lang.String root, java.lang.String publicId, java.lang.String systemId)
|
public void | startDocument() addMarker ("#DOCUMENT", null);
|
public void | startElement(java.lang.String namespace, java.lang.String local, java.lang.String name, org.xml.sax.Attributes attrs) current = new StackEntry (namespace, local, name, attrs, current);
|
public void | startEntity(java.lang.String name)
String uri = (String) extEntities.get (name);
if (uri != null)
addMarker ("#ENTITY", uri);
|