|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsunlabs.brazil.util.LexML
sunlabs.brazil.util.LexHTML (view source)
public class LexHTML
This class breaks up HTML into tokens.
This class differs slightly from LexML as follows: after certain tags,
like the <script>
tag, the body that follows is
uninterpreted data and ends only at the next, in this case,
</script>
tag, not at the just the next
"<" or ">" character. This is one way that HTML is not fully
compliant with XML.
The default set of tags that have this special processing is
<script>
, <style>
, and
<xmp>
. The user can change this by retrieving
the Vector of special tags via
getClosingTags
, and modifying it as needed.
Field Summary |
---|
Fields inherited from class sunlabs.brazil.util.LexML |
---|
COMMENT, STRING, TAG |
Constructor Summary | |
---|---|
LexHTML(String str)
Creates a new HTML parser, which can be used to iterate over the tokens in the given string. |
Method Summary | |
---|---|
Vector |
getClosingTags()
Get the set of HTML tags that have the special body-processing behavior mentioned above. |
String |
getTag()
Gets the tag name at the begining of the current tag. |
boolean |
nextToken()
Advances to the next token, correctly handling HTML tags that have the special body-processing behavior mentioned above. |
void |
replace(String str)
Changes the string that this LexHTML is parsing. |
Methods inherited from class sunlabs.brazil.util.LexML |
---|
getArgs, getAttributes, getBody, getLocation, getString, getToken, getType, isSingleton, rest |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LexHTML(String str)
str
- The HTML to parse.Method Detail |
---|
public Vector getClosingTags()
public boolean nextToken()
This method returns the uninterpreted data making up the body of a
special HTML tag as a token of type LexML.STRING
, even
if the body was actually a comment or another tag.
nextToken
in class LexML
true
if a token was found, false
if there were no more tokens left.public String getTag()
getTag
in class LexML
null
if the
current token does not have a tag name.LexML.getTag()
public void replace(String str)
replace
in class LexML
str
- The string that this LexHTML should now parse.LexML.rest()
|
Version Kenai-svn-r24, Generated 08/18/09 Copyright (c) 2001-2009, Sun Microsystems. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |