com.judoscript.util
Class MarkupParser
java.lang.Object
com.judoscript.util.MarkupParser
public class MarkupParser
- extends java.lang.Object
Constructor Summary |
MarkupParser(java.lang.Object inputStream,
boolean ignoreText,
boolean trimText,
boolean ignoreEmptyText,
boolean attr_casesens)
|
Method Summary |
Markup |
next()
Reads a single element per call. |
Markup |
nextJsp()
Reads a single JSP-like tag. |
static Markup |
parseXMLTree(java.lang.Object inputStream)
|
void |
rushToTag(java.lang.String tagName)
|
void |
rushToTag(java.lang.String[] tagNames)
|
java.lang.String |
rushToTag(java.lang.String[] tagNames,
boolean needText)
Rushes to the intended tag and returns any text prior to the tag
from the current position. |
java.lang.String |
rushToTag(java.lang.String tagName,
boolean needText)
|
void |
setAttrCaseSens(boolean sensitive)
|
void |
setUnescape(boolean set)
|
void |
setWantSpecial(boolean set)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MarkupParser
public MarkupParser(java.lang.Object inputStream,
boolean ignoreText,
boolean trimText,
boolean ignoreEmptyText,
boolean attr_casesens)
setUnescape
public void setUnescape(boolean set)
setWantSpecial
public void setWantSpecial(boolean set)
setAttrCaseSens
public void setAttrCaseSens(boolean sensitive)
next
public Markup next()
throws java.io.IOException
- Reads a single element per call. It can be a markup or a text string.
Special treatment for
<script>
tags: contents
between the opening and closing tags are parsed differently to
accomodate <
occurrences. The only catch now is that
<script>
can not happen anywhere within the code
such as string literals.
- Returns:
- a Markup object.
If is a markup, its "name" key is available; for plain text,
no "name" key, and "text" key contains the text.
Returns null if no more tags nor text.
- Throws:
java.io.IOException
rushToTag
public void rushToTag(java.lang.String tagName)
throws java.io.IOException
- Throws:
java.io.IOException
rushToTag
public java.lang.String rushToTag(java.lang.String tagName,
boolean needText)
throws java.io.IOException
- Throws:
java.io.IOException
rushToTag
public void rushToTag(java.lang.String[] tagNames)
throws java.io.IOException
- Throws:
java.io.IOException
rushToTag
public java.lang.String rushToTag(java.lang.String[] tagNames,
boolean needText)
throws java.io.IOException
- Rushes to the intended tag and returns any text prior to the tag
from the current position. The tag itself is not returned and
will be immediately available for a
next()
call.
If the tag does not exist, the whole document will be passed.
- Throws:
java.io.IOException
nextJsp
public Markup nextJsp()
throws java.io.IOException
- Reads a single JSP-like tag. The tags read are:
<%= %>
<%@ %>
<%! %>
<%-- %>
<% %>
- Returns:
- a Markup object of type TYPE_SPECIAL.
The Markup.specialTagName is the name, and the
Markup.name holds the text for relevant tags.
- Throws:
java.io.IOException
parseXMLTree
public static Markup parseXMLTree(java.lang.Object inputStream)
throws java.io.IOException
- Throws:
java.io.IOException