public class VirtualEadHandler extends SaxXmlHandler
Modifier and Type | Field and Description |
---|---|
protected List<AbstractUnit>[] |
children |
protected String |
eadLanguage
Default language to use in units without language
|
currentEntity, currentGraphPath, currentPath, currentText, depth, importer, languageMap, locator, properties
Constructor and Description |
---|
VirtualEadHandler(ItemImporter<Map<String,Object>,?> importer)
Create an EadHandler using some importer.
|
VirtualEadHandler(ItemImporter<Map<String,Object>,?> importer,
XmlImportProperties xmlImportProperties)
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 |
extractDate(Map<String,Object> currentGraph)
Handler-specific code for extraction or generation of unit dates.
|
protected void |
extractIdentifier(Map<String,Object> currentGraph)
Handler-specific code for extraction or generation of unit IDs.
|
protected void |
extractTitle(Map<String,Object> currentGraph)
Handler-specific code for extraction or generation of unit titles.
|
protected String |
getAuthor() |
protected String |
getDefaultLanguage() |
protected String |
getEadId()
Get the EAD identifier of the EAD being imported
|
protected String |
getSourceFileId() |
protected static boolean |
isUnitDelimiter(String elementName)
Determine if the element represents a unit delimiter
|
protected boolean |
needToCreateSubNode(String qName)
Determines whether a new node that is a 'child' of the current node (i.e.
|
protected List<String> |
pathIds() |
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.
|
protected void |
useDefaultLanguage(Map<String,Object> currentGraph,
String defaultLanguage)
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<AbstractUnit>[] children
protected String eadLanguage
public VirtualEadHandler(ItemImporter<Map<String,Object>,?> importer)
importer
- public VirtualEadHandler(ItemImporter<Map<String,Object>,?> importer, XmlImportProperties xmlImportProperties)
importer
- xmlImportProperties
- public 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
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()
protected String getEadId()
<eadid>
or null if it was not parsed yet or emptyprotected String getAuthor()
protected void useDefaultLanguage(Map<String,Object> currentGraph)
currentGraph
- Data at the current node levelprotected void useDefaultLanguage(Map<String,Object> currentGraph, String defaultLanguage)
currentGraph
- Data at the current node leveldefaultLanguage
- Language code to use as defaultprotected String getDefaultLanguage()
protected void extractTitle(Map<String,Object> currentGraph)
currentGraph
- Data at the current node levelprotected void extractDate(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 QNameprotected static boolean isUnitDelimiter(String elementName)
elementName
- The XML element nameCopyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.