public class AbstractMetaDataHandler extends org.xml.sax.helpers.DefaultHandler
| Modifier and Type | Field and Description |
|---|---|
protected StringBuilder |
charactersBuffer
parser buffer
|
protected EntityResolver |
entityResolver
Entity Resolver to use (if required)
|
protected String |
filename
Filename containing the XML metadata
|
protected MetaData |
metadata
The MetaData for this file (the end result of the parse process).
|
protected MetaDataManager |
mmgr
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 mmgr,
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.
|
boolean |
isPersistenceContext() |
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 final MetaDataManager mmgr
protected final String filename
protected MetaData metadata
protected final EntityResolver entityResolver
protected StringBuilder charactersBuffer
protected boolean validate
public AbstractMetaDataHandler(MetaDataManager mmgr, String filename, EntityResolver resolver)
mmgr - Manager for the MetaDatafilename - The filenameresolver - Entity Resolver to use (null if not available)public boolean isPersistenceContext()
public void setValidate(boolean validate)
validate - Whether to validatepublic MetaData getMetaData()
public void error(SAXParseException e) throws SAXException
error in interface ErrorHandlererror in class org.xml.sax.helpers.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 org.xml.sax.helpers.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 org.xml.sax.helpers.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 © 2019. All rights reserved.