## gate.corpora
Class SgmlDocumentFormat

    java.lang.Object
      |
      +--gate.util.AbstractFeatureBearer
            |
            +--gate.creole.AbstractResource
                  |
                  +--gate.creole.AbstractLanguageResource
                        |
                        +--gate.DocumentFormat
                              |
                              +--gate.corpora.TextualDocumentFormat
                                    |
                                    +--gate.corpora.SgmlDocumentFormat

All Implemented Interfaces:
  FeatureBearer, LanguageResource, NameBearer, Resource, Serializable

public class SgmlDocumentFormat
extends TextualDocumentFormat

The format of Documents. Subclasses of DocumentFormat know about particular MIME types and how to unpack the information in any markup or formatting they contain into GATE annotations. Each MIME type has its own subclass of DocumentFormat, e.g. XmlDocumentFormat, RtfDocumentFormat, MpegDocumentFormat. These classes register themselves with a static index residing here when they are constructed. Static getDocumentFormat methods can then be used to get the appropriate format class for a particular document.

See Also:
  Serialized Form

Field Summary
`private static boolean` `DEBUG` Debug flag

Fields inherited from class gate.DocumentFormat
`element2StringMap, features, isGateXmlDocument, magic2mimeTypeMap, markupElementsMap, mimeString2ClassHandlerMap, mimeString2mimeTypeMap, mimeType, statusListeners, suffixes2mimeTypeMap`

Fields inherited from class gate.creole.AbstractLanguageResource
`dataStore, lrPersistentId, serialVersionUID`

Fields inherited from class gate.creole.AbstractResource
`name`

Constructor Summary
`SgmlDocumentFormat()` Default construction

Method Summary
`Resource` `init()` Initialise this resource, and return it.
`private String` `sgml2Xml(Document doc)` This method converts the document's content from SGML 2 XML.
`void` `unpackMarkup(Document doc)` Unpack the markup in the document.

Methods inherited from class gate.corpora.TextualDocumentFormat
`annotateParagraphs, getDataStore`

Methods inherited from class gate.DocumentFormat

`addStatusListener, areEqual, decideBetweenThreeMimeTypes, decideBetweenTwoMimeTypes, fireStatusChanged, getDocumentFormat, getDocumentFormat, getDocumentFormat, getElement2StringMap, getFeatures, getFileSufix, getMarkupElementsMap, getMimeType, getMimeType, getMimeType, guessTypeUsingMagicNumbers, removeStatusListener, runMagicNumbers, setElement2StringMap, setFeatures, setMarkupElementsMap, setMimeType, unpackMarkup`

Methods inherited from class gate.creole.AbstractLanguageResource
`cleanup, getLRPersistenceId, setDataStore, setLRPersistenceId, sync`

Methods inherited from class gate.creole.AbstractResource
`checkParameterValues, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners`

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Methods inherited from interface gate.LanguageResource
`getLRPersistenceId, setDataStore, setLRPersistenceId, sync`

Methods inherited from interface gate.Resource
`cleanup, getParameterValue, setParameterValue, setParameterValues`

Methods inherited from interface gate.util.NameBearer
`getName, setName`

Field Detail

### DEBUG

    private static final boolean DEBUG

  Debug flag

Constructor Detail

### SgmlDocumentFormat

    public SgmlDocumentFormat()

  Default construction

Method Detail

### unpackMarkup

    public void unpackMarkup(Document doc)
                      throws DocumentFormatException

  Unpack the markup in the document. This converts markup from the native format (e.g. SGML) into annotations in GATE format. Uses the markupElementsMap to determine which elements to convert, and what annotation type names to use. The doc's content is first converted to a wel formed XML. If this succeddes then the document is saved into a temp file and parsed as an XML document.
  Overrides:
    `unpackMarkup` in class `TextualDocumentFormat`
  Parameters:
    `Document` - doc The gate document you want to parse.

### sgml2Xml

    private String sgml2Xml(Document doc)

  This method converts the document's content from SGML 2 XML.

### init

    public Resource init()
                  throws ResourceInstantiationException

  Initialise this resource, and return it.
  Overrides:
    `init` in class `TextualDocumentFormat`