|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface is intended to provide limited support for templating in the context of CMS and similar applications, where users are expected to submit HTML that may have custom tags that have to be processed programmaticaly.
For example, suppose you allow a content item body to have the
<footnote>
tag. Suppose the user submits the following HTML
fragment,
<h2>What is Truth?</h2> <p>We've bandied about the term truth,<footnote>Strictly speaking, this is not true.</footnote> and we've mentioned that certain operators return a true or false value. Before we go any further, we really ought to explain exactly what we mean by that. </p>
To render this content correctly, we have to transform this fragment to look like so:
<h2>What is Truth?</h2> <p>We've bandied about the term truth<sup><a href="#fn1">1</a></sup>, and we've mentioned that certain operators return a true or false value. Before we go any further, we really ought to explain exactly what we mean by that. </p> <hr> <p id="fn1"><sup>1</sup>Strictly speaking, this is not true.</p>
So that the rendered output looks like so:
What is Truth?
We've bandied about the term truth1, and we've mentioned that certain operators return a true or false value. Before we go any further, we really ought to explain exactly what we mean by that.
1Strictly speaking, this is not true.
This interface is similar to the SAXParser
interface. One major difference is that this parser normally treats most of
the markup as text whose structure is of no interest to the designated ContentHandler
. See parse(String, ContentHandler)
for more details.
Method Summary | |
boolean |
isRegistered(String qName)
Checks if the tag is registered with this parser. |
void |
parse(String html,
ContentHandler handler)
The interface is designed around the following assumptions. |
void |
registerTag(String qName)
Registers the tag qName . |
Method Detail |
public void registerTag(String qName)
qName
.
public void parse(String html, ContentHandler handler) throws HTMLParserException
The interface is designed around the following assumptions.
registerTag(String)
. All other markup is treated
as text. html
is well-formed with regards to
the special tags. It does not have to be well-formed with regards to
the "normal" markup that has not been registered with the parser via
registerTag(String)
. (Implementations of this interface may, of
course, impose this additional restriction. )
HTMLParserException
public boolean isRegistered(String qName)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |