All Packages Class Hierarchy This Package Previous Next Index
Class edu.vt.marian.Document.SgmlDocument
java.lang.Object
|
+----edu.vt.marian.Document.SgmlDocument
- public class SgmlDocument
- extends Object
- implements Document
SgmlDocument
class description: this class represents an NLM SGML document in the system.
designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu)
implementator(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu), Robert France
finished time:
known bugs:
JDK version: 1.1.5
side effects:
-
EXTRACT_ERROR
-
-
INVALID_TAG_NAME
-
-
NULL_DOCUMENT_STRING
-
-
NULL_FIELD_NAME
-
-
NULL_SGML_STRING
-
-
NULL_STREAM
-
-
OK
- those are the return values of methods of this class
-
SgmlDocument(BufferedReader, Debug)
- create an SgmlDocument object from the specified stream.
-
SgmlDocument(String, Debug)
- create an SgmlDocument object from a document string.
-
attributes()
-
-
copy()
- An attempt to get around declaring public clone() methods.
-
equals(SgmlDocument)
- tell whether this object and the
parameter object represent the same document.
-
getDocumentString()
- return the sgml string of the document this object represents.
-
getFieldData(String)
- return the data of this document corresponding to the specified field
-
getFieldDataByIndex(int)
- return the data of the specified field.
-
getFieldNameByIndex(int)
- return the name of the specified field.
-
getFieldSeparator(String)
- tell the separator between different text strings in the specified field.
-
getNumberFields()
- return the number of fields in this document
-
isValid()
- tell whether the object is valid (not whether it has been extracted yet).
-
presentAttribute(int, int)
-
-
presentAttributes(int)
- return a Vector of metadata attributes for this document.
-
presentFull(int)
- return the full description of this document.
-
presentFull(int, BufferedWriter)
-
-
presentLong(int)
-
-
presentLong(int, BufferedWriter)
-
-
presentShort(int)
- return the short description of this document in one line.
-
presentShort(int, BufferedWriter)
-
-
setDocumentString(String)
- set the sgml string of the document this object represents.
-
toStream(PrintWriter)
- print the contents of this object to the specified stream.
OK
public static final int OK
- those are the return values of methods of this class
NULL_STREAM
public static final int NULL_STREAM
NULL_DOCUMENT_STRING
public static final int NULL_DOCUMENT_STRING
NULL_SGML_STRING
public static final int NULL_SGML_STRING
EXTRACT_ERROR
public static final int EXTRACT_ERROR
INVALID_TAG_NAME
public static final int INVALID_TAG_NAME
NULL_FIELD_NAME
public static final int NULL_FIELD_NAME
SgmlDocument
public SgmlDocument(BufferedReader br,
Debug debug)
- create an SgmlDocument object from the specified stream.
- Parameters:
- br - the stream from which to read out this document
- debug - used for debugging
SgmlDocument
public SgmlDocument(String documentString,
Debug debug)
- create an SgmlDocument object from a document string.
- Parameters:
- docString - a string encoding this document in SGML
- debug - used for debugging
isValid
public boolean isValid()
- tell whether the object is valid (not whether it has been extracted yet).
equals
public boolean equals(SgmlDocument d)
- tell whether this object and the
parameter object represent the same document.
NOTE: At this point we are using String compare on the
raw strings to determine equality. This obviously leaves
something to be desired.
- Parameters:
- d - the document used to compare with this object
- Returns:
- true / false
toStream
public int toStream(PrintWriter pw)
- print the contents of this object to the specified stream.
- Parameters:
- pw - the stream to which to write this object
- Returns:
- OK -- this object has been written to the stream correctly
NULL_STREAM -- the parameter stream is null
getDocumentString
public String getDocumentString()
- return the sgml string of the document this object represents.
- Returns:
- the raw form of this document as a string
setDocumentString
public int setDocumentString(String documentString)
- set the sgml string of the document this object represents.
- Parameters:
- documentString - this will become the new raw string for
this document object
- Returns:
- OK -- the new raw marc record has been set correctly
NULL_DOCUMENT_STRING -- the parameter is null
getNumberFields
public int getNumberFields()
- return the number of fields in this document
getFieldNameByIndex
public String getFieldNameByIndex(int index)
- return the name of the specified field.
getFieldDataByIndex
public String getFieldDataByIndex(int index)
- return the data of the specified field.
getFieldData
public String getFieldData(String field_name)
- return the data of this document corresponding to the specified field
- Returns:
- the field data in the form of a String, or
null -- extraction problem
getFieldSeparator
public String getFieldSeparator(String fieldName)
- tell the separator between different text strings in the specified field.
- Parameters:
- fieldName - name of field to search
- Returns:
- String, or null if no such field exists.
copy
public DigInfObj copy()
- An attempt to get around declaring public clone() methods.
presentShort
public String presentShort(int markupType)
- return the short description of this document in one line.
- Parameters:
- markupType - how to mark up the string returned (e.g., HTML or ASCII).
- Returns:
- the short description String.
presentAttributes
public Vector presentAttributes(int markupType)
- return a Vector of metadata attributes for this document.
- Parameters:
- markupType - how to mark up the string returned (e.g., HTML or ASCII).
- Returns:
- a Vector of triples [attrName, attrType, attrValue].
attributes
public Vector attributes()
presentAttribute
public Object presentAttribute(int attrID,
int markupType)
presentFull
public String presentFull(int markupType)
- return the full description of this document.
- Parameters:
- markupType - how to mark up the string returned (e.g., HTML or ASCII).
- Returns:
- a (potentially very long) String.
presentShort
public int presentShort(int markupType,
BufferedWriter out) throws IOException
presentLong
public String presentLong(int markupType)
presentLong
public int presentLong(int markupType,
BufferedWriter out) throws IOException
presentFull
public int presentFull(int markupType,
BufferedWriter out) throws IOException
All Packages Class Hierarchy This Package Previous Next Index