public class AbstractMetaDataHandler extends DefaultHandler
| Modifier and Type | Field and Description |
|---|---|
protected StringBuffer |
charactersBuffer
parser buffer
|
protected EntityResolver |
entityResolver
Entity Resolver to use (if required)
|
protected String |
filename
Filename for the parsed file.
|
protected static Localiser |
LOCALISER
Localiser for messages.
|
protected MetaData |
metadata
The MetaData for this file (the end result of the parse process.
|
protected MetaDataManager |
mgr
Manager for the MetaData.
|
protected Stack<MetaData> |
stack
Stack of meta-data elements.
|
protected boolean |
validate
Whether to validate while parsing.
|
| Constructor and Description |
|---|
AbstractMetaDataHandler(MetaDataManager mgr,
String filename,
EntityResolver resolver)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Notification handler for the "body" data inside an element.
|
void |
error(SAXParseException e)
Parser error method.
|
protected String |
getAttr(Attributes attrs,
String key)
Accessor for an attribute out of the attributes for an element.
|
protected String |
getAttr(Attributes attrs,
String key,
String defaultValue)
Accessor for an attribute out of the attributes for an element.
|
MetaData |
getMetaData()
Accessor for the MetaData for this file.
|
protected MetaData |
getStack()
Accessor for the current MetaData component.
|
String |
getString()
Accessor for the "body" text metadata.
|
protected MetaData |
popStack()
Method to remove the current MetaData component from the Stack.
|
protected void |
pushStack(MetaData md)
Method to add a MetaData component to the Stack.
|
InputSource |
resolveEntity(String publicId,
String systemId)
Method to resolve XML entities.
|
void |
setValidate(boolean validate)
Method to set whether to validate during the the handling.
|
endDocument, endElement, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warningprotected static final Localiser LOCALISER
protected final MetaDataManager mgr
protected final String filename
protected MetaData metadata
protected final EntityResolver entityResolver
protected StringBuffer charactersBuffer
protected boolean validate
public AbstractMetaDataHandler(MetaDataManager mgr, String filename, EntityResolver resolver)
mgr - Manager for the MetaDatafilename - The filenameresolver - Entity Resolver to use (null if not available)public void setValidate(boolean validate)
validate - Whether to validatepublic MetaData getMetaData()
public void error(SAXParseException e) throws SAXException
error in interface ErrorHandlererror in class DefaultHandlere - Parse ExceptionSAXExceptionErrorHandler.error(org.xml.sax.SAXParseException)protected String getAttr(Attributes attrs, String key, String defaultValue)
attrs - The attributeskey - Key for the attribute to returndefaultValue - A default to impose if no value.protected String getAttr(Attributes attrs, String key)
attrs - The attributeskey - Key for the attribute to returnpublic InputSource resolveEntity(String publicId, String systemId) throws SAXException
resolveEntity in interface EntityResolverresolveEntity in class DefaultHandlerpublicId - The public id.systemId - The system id.SAXExceptionEntityResolver.resolveEntity(java.lang.String,java.lang.String)public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerch - The charactersstart - The start position in the character array.length - The length of the string.SAXException - in parsing errorspublic String getString()
protected MetaData getStack()
protected MetaData popStack()
protected void pushStack(MetaData md)
md - The component to add.Copyright © 2013. All Rights Reserved.