org.licas.service.resource.info

## Class InfoHtml

- java.lang.Object
- - org.licas.service.resource.Resource
  - - org.licas.service.resource.info.InfoURL
    - - org.licas.service.resource.info.InfoHtml

-     public class InfoHtml
      extends InfoURL

  This is used by the `InformationService` to store and parse a remote html file. The content can also be stored locally if the action element declares it to be stored locally through `AiConst`.`LOADCONTENT`. The default for an html resource is to link to the html file, where the content is dynamically retrieved and parsed when the info is requested. An alternative to this would be the `InfoStreamXml` resource.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `REFERENCES`
    `static java.lang.String` | `TEXTONLY` InfoHtml types

    - ### Fields inherited from class org.licas.service.resource.info.InfoURL

      `url, urlData`

    - ### Fields inherited from class org.licas.service.resource.Resource

      `dataType, INFOANYTYPE, INFOBINARYTYPE, INFOHTMLTYPE, INFOSTREAMXMLTYPE, INFOSTRINGTYPE, INFOTEXTTYPE, INFOURLTYPE, INFOXMLTYPE, LISTCONTAINERTYPE, QUERYCONTAINERTYPE, RANDOMCONTAINERTYPE, uuid`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfoHtml(java.lang.String theDataType, org.licas_xml.abs.Element dataXml)` Create a new instance of InfoHtml.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.licas_xml.abs.Element` | `getInfo(org.licas_xml.abs.Element infoDescr)` Get the currently loaded source information wrapped in an XML element.
    `org.licas_xml.abs.Element` | `getInfoFor(java.lang.String thisPart)` Get the currently loaded source information wrapped in an XML element, but return only the part of it that is relevant to the specified variable.
    `java.lang.Object` | `getValue(org.licas_xml.abs.Element infoDescr)` Get the value itself and not a wrapped description.
    `boolean` | `parseInfo(org.licas_xml.abs.Element dataXml)` Parse the data description in the document to create the data object.

    - ### Methods inherited from class org.licas.service.resource.info.InfoURL

      `getURL`

    - ### Methods inherited from class org.licas.service.resource.Resource

      `createResource, dataFromResourceType, getDataType, getUUID, parseValueElem, resourceTypeForDataType, setUUID, setUUID`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TEXTONLY

          public static final java.lang.String TEXTONLY

      InfoHtml types
      See Also:
        Constant Field Values

    - #### REFERENCES

          public static final java.lang.String REFERENCES

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InfoHtml

          public InfoHtml(java.lang.String theDataType,
                          org.licas_xml.abs.Element dataXml)
                   throws java.lang.Exception

      Create a new instance of InfoHtml.
      Parameters:
        `theDataType` - the resource data type.
        `dataXml` - a description of the initialisation parameters. Can be null, or it can specify a list of specific parts to return.
      Throws:
        `java.lang.Exception` - any error.

  - ### Method Detail

    - #### parseInfo

          public boolean parseInfo(org.licas_xml.abs.Element dataXml)
                            throws java.lang.Exception

      Parse the data description in the document to create the data object.
      Overrides:
        `parseInfo` in class `InfoURL`
      Parameters:
        `dataXml` - this must include a `VALUE` element that stores a String-based URL path description. The data is then retrieved from this location upon request.

        The `Value` element can be in one of two forms. It can store directly a String-based URL file path description, or it can store child elements that include a URL path as well as HTML parts that should be retrieved only. It can therefore look like either: `<Value>url address</Value>` or `<Value><URL>url address</URL><Include>part 1</Include><Include>part 2</Include></Value>`. The include parts are in this case: `TEXTONLY`, `REFERENCES`. 'Text only' removes all of the html formatting, while 'references' should parse the html document and return a hyperlinks list only.

      Returns:
        true if the file was successfully loaded, false otherwise.
      Throws:
        `java.lang.Exception` - any error.

    - #### getInfo

          public org.licas_xml.abs.Element getInfo(org.licas_xml.abs.Element infoDescr)
                                            throws java.lang.Exception

      Get the currently loaded source information wrapped in an XML element. This is the whole unparsed html document. Alternatively, if a list of parts to include has been specified in the initialisation script, only those parts get returned instead.
      Overrides:
        `getInfo` in class `InfoURL`
      Parameters:
        `infoDescr` - a description of the info resource value that should be retrieved. Can be null as not used in this version.
      Returns:
        the value of the resource info as an XML element. This format is consistent with adding a `Data` element through an admin document. HTML description is coded, so probably need to use `XmlHandler.removeStringSpec(...)` after retrieving the XML `Data` element's text content on the client side.
      Throws:
        `java.lang.Exception` - any error.

    - #### getInfoFor

          public org.licas_xml.abs.Element getInfoFor(java.lang.String thisPart)
                                               throws java.lang.Exception

      Get the currently loaded source information wrapped in an XML element, but return only the part of it that is relevant to the specified variable. for parsed HTML, for example, the readable content (`TEXTONLY`) or a list of HTTP references (`REFERENCES`). So the info part can specify this and it can be different or separate from the resource initialisation script.
      Parameters:
        `thisPart` - a description of the info part to return.
      Returns:
        the value of the resource info part as an XML element. This format is consistent with adding `Data` through an admin document.
      Throws:
        `java.lang.Exception` - any error.

    - #### getValue

          public java.lang.Object getValue(org.licas_xml.abs.Element infoDescr)
                                    throws java.lang.Exception

      Get the value itself and not a wrapped description. This is the URL address as a string.
      Overrides:
        `getValue` in class `InfoURL`
      Parameters:
        `infoDescr` - a description of the info resource value that should be retrieved. Can be null as not used in this version.
      Returns:
        the info value.
      Throws:
        `java.lang.Exception` - any error.