|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.apache.commons.digester.Digester
de.pangaea.metadataportal.utils.ExtendedDigester
public class ExtendedDigester
Extension of the Commons Digester Class, that works around some limitations/bugs. It is
especially important for SaxRule, as it supports a stack/list of namespace-prefix assignments,
and contains a integrated error handler. It also gives the possibility to not allow
invalid element names.
| Nested Class Summary | |
|---|---|
static class |
ExtendedDigester.DoNothingRule
This rule does nothing. |
| Field Summary | |
|---|---|
protected HashMap<String,LinkedList<String>> |
currentNamespaceMap
|
protected ContentHandler |
custContentHandler
|
| Fields inherited from class org.apache.commons.digester.Digester |
|---|
bodyText, bodyTexts, classLoader, configured, entityResolver, entityValidator, errorHandler, factory, inputSources, JAXP_SCHEMA_LANGUAGE, locator, log, match, matches, namespaceAware, namespaces, params, parser, publicId, reader, root, rules, saxLog, schema, schemaLanguage, schemaLocation, stack, substitutor, useContextClassLoader, validating, W3C_XML_SCHEMA, xincludeAware |
| Constructor Summary | |
|---|---|
ExtendedDigester()
|
|
| Method Summary | |
|---|---|
void |
addDoNothing(String pattern)
Adds a dummy rule for element paths, that are allowed, but not parsed. |
void |
characters(char[] ch,
int start,
int length)
|
void |
clear()
|
void |
endElement(String uri,
String localName,
String qName)
|
void |
endPrefixMapping(String prefix)
|
void |
error(SAXParseException ex)
Just throws ex. |
void |
fatalError(SAXParseException ex)
Just throws ex. |
Set<String> |
getCurrentAssignedPrefixes()
Returns all current namespace prefix that are assigned. |
NamespaceContext |
getCurrentNamespaceContext(boolean strict,
boolean reDefineDefaultPrefix)
Returns the current NamespaceContext for compiling XPath expressions. |
String |
getCurrentNamespaceForPrefix(String prefix)
Returns the current namespace URI for the given prefix. |
Map<String,String> |
getCurrentNamespaceMap()
Returns the current namespace prefix mappings as modifiable Map containing the prefix
and the current namespace assignment (it is just a copy of the internal representation's current mapping). |
ContentHandler |
getCustomContentHandler()
Gets the custom event handler. |
ErrorHandler |
getErrorHandler()
Not supported, always returns null |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
void |
processingInstruction(String target,
String data)
|
void |
replayEndPrefixMappings(ContentHandler handler,
Set<String> excludeNamespaces)
Replays all current prefix mappings for another ContentHandler (end mapping). |
void |
replayStartPrefixMappings(ContentHandler handler,
Set<String> excludeNamespaces)
Replays all current prefix mappings for another ContentHandler (start mapping). |
void |
setCustomContentHandler(ContentHandler c)
Sets a custom ContentHandler, that receives all SAX events until disabled (null). |
void |
setErrorHandler(ErrorHandler err)
Not suppoted, always throws IllegalArgumentException if not null. |
void |
setRulesWithInvalidElementCheck(org.apache.commons.digester.Rules rules)
Adds a default Rule for not allowing invalid (not registered) event paths. |
void |
skippedEntity(String name)
|
void |
startDocument()
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
|
void |
startPrefixMapping(String prefix,
String uri)
|
void |
warning(SAXParseException ex)
Logs the SAX exception as warning (with location). |
| Methods inherited from class org.apache.commons.digester.Digester |
|---|
addBeanPropertySetter, addBeanPropertySetter, addCallMethod, addCallMethod, addCallMethod, addCallMethod, addCallParam, addCallParam, addCallParam, addCallParam, addCallParamPath, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addFactoryCreate, addObjectCreate, addObjectCreate, addObjectCreate, addObjectCreate, addObjectParam, addRule, addRuleSet, addSetNestedProperties, addSetNestedProperties, addSetNestedProperties, addSetNext, addSetNext, addSetProperties, addSetProperties, addSetProperties, addSetProperty, addSetRoot, addSetRoot, addSetTop, addSetTop, cleanup, configure, createInputSourceFromURL, createInputSourceFromURL, createSAXException, createSAXException, createSAXException, endDocument, findNamespaceURI, getClassLoader, getCount, getCurrentElementName, getCurrentNamespaces, getDebug, getDocumentLocator, getEntityResolver, getFactory, getFeature, getLogger, getMatch, getNamespaceAware, getParser, getProperty, getPublicId, getReader, getRoot, getRuleNamespaceURI, getRules, getSAXLogger, getSchema, getSchemaLanguage, getStackAction, getSubstitutor, getUseContextClassLoader, getValidating, getXIncludeAware, getXMLReader, getXMLSchema, initialize, isEmpty, log, log, notationDecl, parse, parse, parse, parse, parse, parse, peek, peek, peek, peek, peekParams, peekParams, pop, pop, popParams, push, push, pushParams, register, register, resetRoot, resolveEntity, setClassLoader, setDebug, setDocumentLocator, setEntityResolver, setFeature, setLogger, setNamespaceAware, setProperty, setPublicId, setRuleNamespaceURI, setRules, setSAXLogger, setSchema, setSchemaLanguage, setStackAction, setSubstitutor, setUseContextClassLoader, setValidating, setXIncludeAware, setXMLSchema, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final HashMap<String,LinkedList<String>> currentNamespaceMap
protected ContentHandler custContentHandler
| Constructor Detail |
|---|
public ExtendedDigester()
| Method Detail |
|---|
public void setCustomContentHandler(ContentHandler c)
ContentHandler, that receives all SAX events until disabled (null).
setCustomContentHandler in class org.apache.commons.digester.Digesterpublic ContentHandler getCustomContentHandler()
getCustomContentHandler in class org.apache.commons.digester.Digesterpublic void setErrorHandler(ErrorHandler err)
IllegalArgumentException if not null.
setErrorHandler in class org.apache.commons.digester.Digesterpublic ErrorHandler getErrorHandler()
null
getErrorHandler in class org.apache.commons.digester.Digesterpublic void addDoNothing(String pattern)
public void setRulesWithInvalidElementCheck(org.apache.commons.digester.Rules rules)
setRules(Rules rules).
public void clear()
clear in class org.apache.commons.digester.Digester
public void startPrefixMapping(String prefix,
String uri)
throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.apache.commons.digester.DigesterSAXException
public void endPrefixMapping(String prefix)
throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class org.apache.commons.digester.DigesterSAXException
public void startElement(String uri,
String localName,
String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class org.apache.commons.digester.DigesterSAXException
public void endElement(String uri,
String localName,
String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class org.apache.commons.digester.DigesterSAXException
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.apache.commons.digester.DigesterSAXException
public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class org.apache.commons.digester.DigesterSAXException
public void processingInstruction(String target,
String data)
throws SAXException
processingInstruction in interface ContentHandlerprocessingInstruction in class org.apache.commons.digester.DigesterSAXException
public void skippedEntity(String name)
throws SAXException
skippedEntity in interface ContentHandlerskippedEntity in class org.apache.commons.digester.DigesterSAXException
public void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.apache.commons.digester.DigesterSAXException
public void warning(SAXParseException ex)
throws SAXException
warning in interface ErrorHandlerwarning in class org.apache.commons.digester.DigesterSAXException
public void error(SAXParseException ex)
throws SAXException
ex.
error in interface ErrorHandlererror in class org.apache.commons.digester.DigesterSAXException
public void fatalError(SAXParseException ex)
throws SAXException
ex.
fatalError in interface ErrorHandlerfatalError in class org.apache.commons.digester.DigesterSAXException
public void replayStartPrefixMappings(ContentHandler handler,
Set<String> excludeNamespaces)
throws SAXException
ContentHandler (start mapping).
handler - the handler which ContentHandler.startPrefixMapping(java.lang.String, java.lang.String) is called.excludeNamespaces - are prefixes for namespaces that should not be reported.
SAXException
public void replayEndPrefixMappings(ContentHandler handler,
Set<String> excludeNamespaces)
throws SAXException
ContentHandler (end mapping).
handler - the handler which ContentHandler.endPrefixMapping(java.lang.String) is called.excludeNamespaces - are prefixes for namespaces that should not be reported.
SAXExceptionpublic Set<String> getCurrentAssignedPrefixes()
public String getCurrentNamespaceForPrefix(String prefix)
public Map<String,String> getCurrentNamespaceMap()
Map containing the prefix
and the current namespace assignment (it is just a copy of the internal representation's current mapping).
public NamespaceContext getCurrentNamespaceContext(boolean strict,
boolean reDefineDefaultPrefix)
NamespaceContext for compiling XPath expressions.
strict - denotes, that undeclared prefixes throw an IllegalArgumentException, like XSLT does it.reDefineDefaultPrefix - denotes, that the default "xmlns" is reassigned. This conforms to XSLT.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||