Package org.datanucleus.metadata.xml
Class PersistenceXmlMetaDataHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
org.datanucleus.metadata.xml.PersistenceXmlMetaDataHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
XML parser handler for "persistence.xml" files to convert them into a PersistenceFileMetaData.
Implements DefaultHandler and handles the extracting of MetaData from the XML elements/attributes.
This class simply constructs the MetaData representation mirroring what is in the XML MetaData file.
Operates the parse process using a Stack. XML MetaData components are added to the stack as they are encountered and created. They are then popped off the stack when the end element is encountered.
-
Field Summary
FieldsFields inherited from class org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
charactersBuffer, clr, entityResolver, filename, metadata, mmgr, stack, validate
-
Constructor Summary
ConstructorsConstructorDescriptionPersistenceXmlMetaDataHandler
(MetaDataManager mgr, String filename, EntityResolver resolver) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
endElement
(String uri, String localName, String qName) Handler method called at the end of an element.void
startElement
(String uri, String localName, String qName, Attributes attrs) Handler method called at the start of an element.Methods inherited from class org.datanucleus.metadata.xml.AbstractXmlMetaDataHandler
characters, error, getAttr, getAttr, getMetaData, getStack, getString, isPersistenceContext, popStack, pushStack, resolveEntity, setValidate
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
rootURI
URI rootURI
-
-
Constructor Details
-
PersistenceXmlMetaDataHandler
Constructor. Protected to prevent instantiation.- Parameters:
mgr
- the metadata manager (not used)filename
- The name of the file to parseresolver
- Entity Resolver to use (null if not available)
-
-
Method Details
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException Handler method called at the start of an element.- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
uri
- URI of the taglocalName
- Local nameqName
- Element nameattrs
- Attributes for this element- Throws:
SAXException
- in parsing errors
-
endElement
Handler method called at the end of an element.- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Parameters:
uri
- URI of the taglocalName
- local nameqName
- Name of element just ending- Throws:
SAXException
- in parsing errors
-