public class EadHandler extends SaxXmlHandler
Modifier and Type | Field and Description |
---|---|
protected List<DocumentaryUnit>[] |
children |
currentEntity, currentGraphPath, currentPath, currentText, depth, importer, languageMap, locator, properties
Constructor and Description |
---|
EadHandler(ItemImporter<Map<String,Object>,?> importer)
Create an EadHandler using some importer.
|
EadHandler(ItemImporter<Map<String,Object>,?> importer,
XmlImportProperties properties)
Create an EadHandler using some importer, and a mapping of paths to node properties.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOtherIdentifier(Map<String,Object> currentGraph,
String otherIdentifier)
Helper method to add identifiers to the list of other identifiers.
|
void |
endElement(String uri,
String localName,
String qName)
Called when the XML parser encounters an end tag.
|
protected void |
extractIdentifier(Map<String,Object> currentGraph)
Handler-specific code for extraction or generation of unit IDs.
|
protected void |
extractTitle(Map<String,Object> currentGraph)
if no NAME_KEY is provided, use the IDENTIFIER_KEY
|
protected String |
getSourceFileId() |
protected boolean |
needToCreateSubNode(String qName)
Determines whether a new node that is a 'child' of the current node (i.e.
|
protected List<String> |
pathIds()
Get the full 'path of identifiers' of the current node.
|
InputSource |
resolveEntity(String publicId,
String systemId)
Set a custom resolver so EAD DTDs are never looked up online.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
Receive an opening tag.
|
protected void |
useDefaultLanguage(Map<String,Object> currentGraph)
Checks given currentGraph for a language and sets a default language code
for the description if no language is found.
|
characters, comment, endCDATA, endDTD, endEntity, getMappedProperty, overwritePropertyInCurrentGraph, printGraph, putPropertyInCurrentGraph, putSubGraphInCurrentGraph, setDocumentLocator, startCDATA, startDTD, startEntity
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, skippedEntity, startDocument, startPrefixMapping
protected final List<DocumentaryUnit>[] children
public EadHandler(ItemImporter<Map<String,Object>,?> importer)
importer
- the importer instancepublic EadHandler(ItemImporter<Map<String,Object>,?> importer, XmlImportProperties properties)
importer
- the importer instanceproperties
- an XML node properties instancepublic InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity
in interface EntityResolver
resolveEntity
in class org.xml.sax.helpers.DefaultHandler
SAXException
IOException
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
SaxXmlHandler
startElement
in interface ContentHandler
startElement
in class SaxXmlHandler
SAXException
protected List<String> pathIds()
public void endElement(String uri, String localName, String qName) throws SAXException
Certain elements represent subcollections, for which we create new nodes (here, we create representative Maps for nodes). Many EAD producers use the standard in their own special way, so this method calls generalised methods to filter, get data in the right place and reformat. If a collection of EAD files need special treatment to get specific data in the right place, you only need to override the other methods (in order: extractIdentifier, extractTitle, extractDate).
endElement
in interface ContentHandler
endElement
in class SaxXmlHandler
SAXException
protected String getSourceFileId()
<eadid>
, extended with the languageTag or null if it was not parsed yet or emptyprotected void useDefaultLanguage(Map<String,Object> currentGraph)
currentGraph
- Data at the current node levelprotected void extractTitle(Map<String,Object> currentGraph)
currentGraph
- Data at the current node levelprotected void extractIdentifier(Map<String,Object> currentGraph)
currentGraph
- Data at the current node levelprotected void addOtherIdentifier(Map<String,Object> currentGraph, String otherIdentifier)
currentGraph
- the node representation to add the otherIdentifier tootherIdentifier
- the alternative identifier to addprotected boolean needToCreateSubNode(String qName)
SaxXmlHandler
needToCreateSubNode
in class SaxXmlHandler
qName
- the QNameCopyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.