|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gate.yam.convert.HtmlToYamConverter
public class HtmlToYamConverter
Convert HTML to YAM. The bulk of the conversion work is done by an XSLT stylesheet, but there is a small amount of pre-processing done in Java to fix up things that are very difficult or impossible to do in XSLT. In particular, for lists that are nested inside other lists, e.g.:
<ul> <li>A list item <ul> <li>Nested list</li> </ul></li> </ul>we must strip the whitespace between the parent
li
text ("A
list item<newline><four spaces>") and the opening nested
ul
tag, otherwise the list nesting is lost in the generated
yam.
Constructor Summary | |
---|---|
HtmlToYamConverter()
|
Method Summary | |
---|---|
static String |
domToString(Document input)
Transforms a DOM document into a String representation in YAM format. |
static String |
jdomToString(org.jdom.Document input)
Transforms a DOM document into a String representation in YAM format. |
static void |
main(String[] args)
Test code - DO NOT USE! |
static String |
readerToString(Reader htmlReader)
Converts HTML source provided from a reader to YAM format returned as string. |
static String |
stringToString(String htmlSource)
Converts HTML source provided as String to YAM format returned as String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HtmlToYamConverter()
Method Detail |
---|
public static String stringToString(String htmlSource) throws SAXException, IOException, TransformerException
htmlSource
- the String representation of the input HTML document.
SAXException
IOException
TransformerException
public static String readerToString(Reader htmlReader) throws SAXException, IOException, TransformerException
htmlReader
- the Reader supplying the html source document
SAXException
IOException
TransformerException
public static String domToString(Document input) throws TransformerException
input
- the input DOM document, in HTML
TransformerException
public static String jdomToString(org.jdom.Document input) throws TransformerException
input
- the jDom document, in HTML
TransformerException
public static void main(String[] args) throws Exception
args
-
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |