org.webdocwf.util.smime.util
Class HtmlAnalyzer

java.lang.Object
  |
  +--org.webdocwf.util.smime.util.HtmlAnalyzer

public class HtmlAnalyzer
extends java.lang.Object

HtmlAnalyzer class is used for parsing html code which has to become content of the message. For parsing is used JTidy parser. As result of parsing, DOM (Document Object Model) structure is obtained. It is tree-like construction with nodes and hierarchical structures that descript input html code. This structure is easy for browsing and searching for specific html elements and attributes. By using DOM, all references to resources (image, movie, sound... ), defined in "src" and "background" attributes, are explored and swapped with generated unique Content-ID values which are necessary in forming "multipart/related" MimeMultipart object.

DOM, generated inside of the object of this class, is also used in the process of generation plain/text message based on, and derived from the given html code. This plain text is later used in creation of "multipart/alternative" MimeMultipart object.


Constructor Summary
HtmlAnalyzer(java.io.InputStream content0)
          Constructs HtmlAnalyzer from data given from InputStream.
HtmlAnalyzer(java.io.InputStream content0, java.lang.String path0)
          Constructs HtmlAnalyzer from data given from InputStream.
 
Method Summary
 java.lang.String getHtmlText()
          Returns html/text document passed throught JTidy html parser.
 java.lang.String getPlainText()
          Returns plain/text representation of given html code document
 java.util.Vector getSwappedAdresses()
          Returns pairs of swapped resource URL adresses or File paths and appropriate generated Content IDs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlAnalyzer

public HtmlAnalyzer(java.io.InputStream content0)
             throws SMIMEException
Constructs HtmlAnalyzer from data given from InputStream. This constructor parses html code from input stream withouth swaping resources' locations from atribute's "src" and "background" value with generated Content-ID values. Also, it is performed generation of plain text message based on html code.
Parameters:
content0 - html code given as InputStream

HtmlAnalyzer

public HtmlAnalyzer(java.io.InputStream content0,
                    java.lang.String path0)
             throws SMIMEException
Constructs HtmlAnalyzer from data given from InputStream. This constructor parses html code from input stream with swaping resources' locations from atribute's "src and "background" value with generated Content-ID values. In that process, it is used given second paremeter "path0" which represents common path to all resources in html code with relative path adresses. Also, it is performed generation of plain text message based on html code.
Parameters:
content0 - html code given as InputStream.
path0 - common path used for resolving all resources in html code with relative path adresses.
Method Detail

getSwappedAdresses

public java.util.Vector getSwappedAdresses()
Returns pairs of swapped resource URL adresses or File paths and appropriate generated Content IDs.
Returns:
Vector object whose even (and 0) indexes contain resource addresses as File or String objects, and whose odd indexes contain appropriate swapped Content-ID values.

getPlainText

public java.lang.String getPlainText()
Returns plain/text representation of given html code document
Returns:
html document transformed to plain/text.

getHtmlText

public java.lang.String getHtmlText()
                             throws SMIMEException
Returns html/text document passed throught JTidy html parser. All resource references which were accessible on the file system are swapped with generated content ID value. Also, all virtual references to appropriate InputStream resources (see setContent methods in classes from package org.webdocwf.util.smime.smime) are also swapped with generated Content-ID value.
Returns:
parsed html/text document.
Throws:
SMIMEException - caused by non SMIMEException which is: UnsupportedEncodingException.


Copyright © 2002-2002 Together Teamlösungen. All Rights Reserved.