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:


Variable Index

 o EXTRACT_ERROR
 o INVALID_TAG_NAME
 o NULL_DOCUMENT_STRING
 o NULL_FIELD_NAME
 o NULL_SGML_STRING
 o NULL_STREAM
 o OK
those are the return values of methods of this class

Constructor Index

 o SgmlDocument(BufferedReader, Debug)
create an SgmlDocument object from the specified stream.
 o SgmlDocument(String, Debug)
create an SgmlDocument object from a document string.

Method Index

 o attributes()
 o copy()
An attempt to get around declaring public clone() methods.
 o equals(SgmlDocument)
tell whether this object and the parameter object represent the same document.
 o getDocumentString()
return the sgml string of the document this object represents.
 o getFieldData(String)
return the data of this document corresponding to the specified field
 o getFieldDataByIndex(int)
return the data of the specified field.
 o getFieldNameByIndex(int)
return the name of the specified field.
 o getFieldSeparator(String)
tell the separator between different text strings in the specified field.
 o getNumberFields()
return the number of fields in this document
 o isValid()
tell whether the object is valid (not whether it has been extracted yet).
 o presentAttribute(int, int)
 o presentAttributes(int)
return a Vector of metadata attributes for this document.
 o presentFull(int)
return the full description of this document.
 o presentFull(int, BufferedWriter)
 o presentLong(int)
 o presentLong(int, BufferedWriter)
 o presentShort(int)
return the short description of this document in one line.
 o presentShort(int, BufferedWriter)
 o setDocumentString(String)
set the sgml string of the document this object represents.
 o toStream(PrintWriter)
print the contents of this object to the specified stream.

Variables

 o OK
 public static final int OK
those are the return values of methods of this class

 o NULL_STREAM
 public static final int NULL_STREAM
 o NULL_DOCUMENT_STRING
 public static final int NULL_DOCUMENT_STRING
 o NULL_SGML_STRING
 public static final int NULL_SGML_STRING
 o EXTRACT_ERROR
 public static final int EXTRACT_ERROR
 o INVALID_TAG_NAME
 public static final int INVALID_TAG_NAME
 o NULL_FIELD_NAME
 public static final int NULL_FIELD_NAME

Constructors

 o 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
 o 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

Methods

 o isValid
 public boolean isValid()
tell whether the object is valid (not whether it has been extracted yet).

 o 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
 o 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

 o getDocumentString
 public String getDocumentString()
return the sgml string of the document this object represents.

Returns:
the raw form of this document as a string
 o 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

 o getNumberFields
 public int getNumberFields()
return the number of fields in this document

 o getFieldNameByIndex
 public String getFieldNameByIndex(int index)
return the name of the specified field.

 o getFieldDataByIndex
 public String getFieldDataByIndex(int index)
return the data of the specified field.

 o 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

 o 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.
 o copy
 public DigInfObj copy()
An attempt to get around declaring public clone() methods.

 o 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.
 o 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].
 o attributes
 public Vector attributes()
 o presentAttribute
 public Object presentAttribute(int attrID,
                                int markupType)
 o 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.
 o presentShort
 public int presentShort(int markupType,
                         BufferedWriter out) throws IOException
 o presentLong
 public String presentLong(int markupType)
 o presentLong
 public int presentLong(int markupType,
                        BufferedWriter out) throws IOException
 o presentFull
 public int presentFull(int markupType,
                        BufferedWriter out) throws IOException

All Packages  Class Hierarchy  This Package  Previous  Next  Index