|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.gate.yam.convert.HtmlToYamConverter
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.
| Field Summary | |
|---|---|
private static String |
XSL_ENCODING
The encoding used for the XSL documents |
private static Set |
listTags
Set containing the HTML element names that represent lists. |
private static Logger |
log
|
private static Transformer |
transformer
The XSL transformer used for HTML to YAM conversions |
| Constructor Summary | |
HtmlToYamConverter()
|
|
| Method Summary | |
|---|---|
static String
|
domToString(org.w3c.dom.Document input)
Transforms a DOM document into a String representation in YAM format. |
private static void
|
initTransformer()
|
static String
|
jdomToString(def 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 Object | |
|---|---|
| wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll |
| Field Detail |
|---|
private static final String XSL_ENCODING
private static Set listTags
private static final Logger log
private static Transformer transformer
| Constructor Detail |
|---|
HtmlToYamConverter()
| Method Detail |
|---|
public static String domToString(org.w3c.dom.Document input)
private static void initTransformer()
public static String jdomToString(def input)
public static void main(String[] args)
public static String readerToString(Reader htmlReader)
public static String stringToString(String htmlSource)
Groovy Documentation