DLESE Tools
v1.6.0

org.dlese.dpc.xml.nldr
Class NldrMetadataRecordExporter

java.lang.Object
  extended by org.dlese.dpc.xml.nldr.NldrMetadataRecordExporter
Direct Known Subclasses:
OsmRecordExporter

public abstract class NldrMetadataRecordExporter
extends Object

Reads XML records and converts to an exported form (i.e., "containing citableUrls"). NLDR metadata records may involve mulitple-namespaces and may conttain "assets" (primary content in the NLDR).

Author:
Jonathan Ostwald

Constructor Summary
NldrMetadataRecordExporter(String xml)
          Constructor that loads the given record.
 
Method Summary
abstract  List getAssetNodes()
          Gets the assetNodes attribute of the NldrMetadataRecord object
protected static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
abstract  String getId()
          Gets the id attribute of the NldrMetadataRecord object
 String getTextAtPath(String path)
          Gets the textAtPath attribute of the NldrMetadataRecord object
 String getXml()
          Gets the xml attribute of the NldrMetadataRecord object
 Node getXmlNode()
          Gets the xmlNode attribute of the NldrMetadataRecord object
 String getXmlStripped()
          Gets the xml stripped of the XML declaration and DTD declaration.
static String makeXPath(String s)
          Expands xpath into namespace-aware version, hanlding attributes and attribute/value specifiers.
protected static void pp(Node node)
          Description of the Method
protected  void prtlnErr(String s)
          Output a line of text to error out, with datestamp.
 List selectNodes(String xpath)
          Select Nodes for provided xpath
 Node selectSingleNode(String xpath)
          Select Single node for provided xpath
static void setDebug(boolean db)
          Sets the debug attribute of the object
 void setTextAtPath(String xpath, String value)
          Sets the textAtPath attribute of the NldrMetadataRecord object
 String toString()
          Get a String representation of this XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NldrMetadataRecordExporter

public NldrMetadataRecordExporter(String xml)
                           throws DocumentException
Constructor that loads the given record. No validation is performed.

Parameters:
xml - The XML to start with
Throws:
DocumentException - If error parsing the XML
Method Detail

getId

public abstract String getId()
Gets the id attribute of the NldrMetadataRecord object

Returns:
The id value

getAssetNodes

public abstract List getAssetNodes()
Gets the assetNodes attribute of the NldrMetadataRecord object

Returns:
The assetNodes value

getTextAtPath

public String getTextAtPath(String path)
Gets the textAtPath attribute of the NldrMetadataRecord object

Parameters:
path - NOT YET DOCUMENTED
Returns:
The textAtPath value

setTextAtPath

public void setTextAtPath(String xpath,
                          String value)
Sets the textAtPath attribute of the NldrMetadataRecord object

Parameters:
xpath - xpath of element
value - text to set

selectNodes

public List selectNodes(String xpath)
Select Nodes for provided xpath

Parameters:
xpath - xpath
Returns:
list of selected nodes

selectSingleNode

public Node selectSingleNode(String xpath)
Select Single node for provided xpath

Parameters:
xpath - xpath
Returns:
NOT YET DOCUMENTED

makeXPath

public static String makeXPath(String s)
Expands xpath into namespace-aware version, hanlding attributes and attribute/value specifiers.

/record/relation
/*[local-name()='record']/*[local-name()='relation'
//relation/@type
//*[local-name()='relation']/@type
/record/relation[@type='Has part']
/*[local-name()='record']/*[local-name()='relation'][@type='Has part']

Parameters:
s - xpath as a qualifed string
Returns:
namespace aware xpath

getXmlNode

public Node getXmlNode()
Gets the xmlNode attribute of the NldrMetadataRecord object

Returns:
The xmlNode value

getXml

public String getXml()
Gets the xml attribute of the NldrMetadataRecord object

Returns:
The xml value

getXmlStripped

public String getXmlStripped()
Gets the xml stripped of the XML declaration and DTD declaration.

Returns:
The xml value

toString

public String toString()
Get a String representation of this XML.

Overrides:
toString in class Object
Returns:
The XML string

getDateStamp

protected static final String getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:

Returns:
The dateStamp value

pp

protected static final void pp(Node node)
Description of the Method

Parameters:
node - Description of the Parameter

prtlnErr

protected final void prtlnErr(String s)
Output a line of text to error out, with datestamp.

Parameters:
s - The text that will be output to error out.

setDebug

public static void setDebug(boolean db)
Sets the debug attribute of the object

Parameters:
db - The new debug value

DLESE Tools
v1.6.0