Linkable.Utility
Class MetaData

java.lang.Object
  |
  +--Linkable.Utility.MetaData

public class MetaData
extends java.lang.Object


Field Summary
private  Creation c
           
private static boolean DEBUG
           
private  org.w3c.dom.Document doc
           
private  javax.xml.parsers.DocumentBuilder domParser
           
private static uk.ac.soton.harvester.EntityDecode ed
           
private  javax.xml.parsers.DocumentBuilderFactory factory
           
private static java.lang.String ME
           
 
Constructor Summary
MetaData(Creation _c)
           
 
Method Summary
static java.lang.String containsDate(java.lang.String inDate)
          containsDate is a convenience routine to rewrite an input string, which contains a date, into "yyyy-mm-dd" format
private  void cookAuthors()
           
private  void cookDate()
           
private  void cookFullID()
           
private  void cookTitle()
           
static void dumpNodes(org.w3c.dom.Document doc)
           
static java.lang.String getAttr(org.w3c.dom.Document doc, java.lang.String name, java.lang.String attr)
          getAttr - Accesses a specific attribute of a specific node name
static java.lang.String getData(java.lang.String filename)
          Reads everything in from what is presumably an XML file and returns it to the caller;
static java.lang.String getDate(java.lang.String url)
          getDate - given an XML file of metadata return contents of a date entry
static org.w3c.dom.Document getDOM(java.lang.String bytes)
          getDOM - given an XML file of metadata as a byte[] array, construct a parse tree.
static java.lang.String getValue(org.w3c.dom.Document doc, java.lang.String name)
          getValue - give the name of a tag in a Document, return the first value
static java.lang.String getValue(org.w3c.dom.Node nameNode)
          getValue - give the name of a tag in an Element, return the element's value.
static java.lang.String[] getValues(org.w3c.dom.Document doc, java.lang.String name)
          getValues - give the name of a tag in a Document, return all values
private  void handleAuthorName(java.lang.String text)
           
private  void handleTitle(java.lang.String text)
           
 void setFile(java.lang.String mf)
          setFile - gives this MetaData object a file to parse cook local metadata into canonical form, and see what it matches in the Creation database.
static java.lang.String toOAMS(java.lang.String inDate)
          toOAMS is a convenience routine to rewrite an input string, which is a date, into OAMS format, which is yyyy-mm-dd
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ME

private static final java.lang.String ME

DEBUG

private static boolean DEBUG

ed

private static uk.ac.soton.harvester.EntityDecode ed

factory

private javax.xml.parsers.DocumentBuilderFactory factory

domParser

private javax.xml.parsers.DocumentBuilder domParser

doc

private org.w3c.dom.Document doc

c

private Creation c
Constructor Detail

MetaData

public MetaData(Creation _c)
Method Detail

setFile

public void setFile(java.lang.String mf)
setFile - gives this MetaData object a file to parse cook local metadata into canonical form, and see what it matches in the Creation database. The local metadata is an XML string.
Parameters:
- - the XML file describing this work Note: a Side Effect is that authors extracted from the metadata are added to the Author database and to Creation c. Creation c is added to the Creation database if not previously there. Note: at present this procedure is invoked only by BibData.

getDOM

public static org.w3c.dom.Document getDOM(java.lang.String bytes)
getDOM - given an XML file of metadata as a byte[] array, construct a parse tree.
Parameters:
- - String is XML data to be parsed. returns Document representing the XML file.

getDate

public static java.lang.String getDate(java.lang.String url)
getDate - given an XML file of metadata return contents of a date entry
Parameters:
- - the URL of the metadata file

getValue

public static java.lang.String getValue(org.w3c.dom.Node nameNode)
getValue - give the name of a tag in an Element, return the element's value.
Parameters:
- - root Node of an XML subtree
- - the String which specifies the tag name returns a String which is the first value of the first tag with this name (or "");

getValue

public static java.lang.String getValue(org.w3c.dom.Document doc,
                                        java.lang.String name)
getValue - give the name of a tag in a Document, return the first value
Parameters:
- - doc is the Document object representing an XML tree
- - name -s the String which specifies the tag name returns a String which is the first value of the first tag with this name (or "");

getValues

public static java.lang.String[] getValues(org.w3c.dom.Document doc,
                                           java.lang.String name)
getValues - give the name of a tag in a Document, return all values
Parameters:
- - doc is the Document object representing an XML tree
- - name -s the String which specifies the tag name returns an array of Strings which are values of the first tag with this name (or null);

getAttr

public static java.lang.String getAttr(org.w3c.dom.Document doc,
                                       java.lang.String name,
                                       java.lang.String attr)
getAttr - Accesses a specific attribute of a specific node name
Parameters:
The - Document containing the XML tree
The - name of the node of interest
The - name of the attribute of interest

dumpNodes

public static void dumpNodes(org.w3c.dom.Document doc)

containsDate

public static java.lang.String containsDate(java.lang.String inDate)
containsDate is a convenience routine to rewrite an input string, which contains a date, into "yyyy-mm-dd" format
Parameters:
the - string that potentially contains a date

toOAMS

public static java.lang.String toOAMS(java.lang.String inDate)
toOAMS is a convenience routine to rewrite an input string, which is a date, into OAMS format, which is yyyy-mm-dd
Parameters:
the - unformatted date, as a string

getData

public static java.lang.String getData(java.lang.String filename)
Reads everything in from what is presumably an XML file and returns it to the caller;
Parameters:
the - absolute pathname of the file to be read in

cookFullID

private void cookFullID()

cookTitle

private void cookTitle()

cookDate

private void cookDate()

cookAuthors

private void cookAuthors()

handleTitle

private void handleTitle(java.lang.String text)

handleAuthorName

private void handleAuthorName(java.lang.String text)