HTML Parser Home Page

org.htmlparser.tags
Class ScriptTag

java.lang.Object
  extended by org.htmlparser.nodes.AbstractNode
      extended by org.htmlparser.nodes.TagNode
          extended by org.htmlparser.tags.CompositeTag
              extended by org.htmlparser.tags.ScriptTag
All Implemented Interfaces:
Serializable, Cloneable, Node, Tag

public class ScriptTag
extends CompositeTag

A script tag.

See Also:
Serialized Form

Field Summary
protected  String mCode
          Script code if different from the page contents.
 
Fields inherited from class org.htmlparser.tags.CompositeTag
mDefaultCompositeScanner, mEndTag
 
Fields inherited from class org.htmlparser.nodes.TagNode
breakTags, mAttributes, mDefaultScanner
 
Fields inherited from class org.htmlparser.nodes.AbstractNode
children, mPage, nodeBegin, nodeEnd, parent
 
Constructor Summary
ScriptTag()
          Create a new script tag.
 
Method Summary
 String[] getEndTagEnders()
          Return the set of end tag names that cause this tag to finish.
 String[] getIds()
          Return the set of names handled by this tag.
 String getLanguage()
          Get the LANGUAGE attribute, if any.
 String getScriptCode()
          Get the script code.
 String getType()
          Get the TYPE attribute, if any.
protected  void putChildrenInto(StringBuffer sb, boolean verbatim)
          Places the script contents into the provided buffer.
 void setLanguage(String language)
          Set the language of the script tag.
 void setScriptCode(String code)
          Set the code contents.
 void setType(String type)
          Set the mime type of the script tag.
 String toString()
          Print the contents of the script tag suitable for debugging display.
 
Methods inherited from class org.htmlparser.tags.CompositeTag
accept, childAt, children, collectInto, digupStringNode, elements, findPositionOf, findPositionOf, findPositionOf, getChild, getChildCount, getChildrenAsNodeArray, getChildrenHTML, getEndTag, getStringText, getText, putEndTagInto, removeChild, searchByName, searchFor, searchFor, searchFor, searchFor, setEndTag, toHtml, toPlainTextString, toString
 
Methods inherited from class org.htmlparser.nodes.TagNode
breaksFlow, getAttribute, getAttributeEx, getAttributesEx, getEnders, getEndingLineNumber, getRawTagName, getStartingLineNumber, getTagBegin, getTagEnd, getTagName, getThisScanner, isEmptyXmlTag, isEndTag, removeAttribute, setAttribute, setAttribute, setAttribute, setAttributeEx, setAttributesEx, setEmptyXmlTag, setTagBegin, setTagEnd, setTagName, setText, setThisScanner
 
Methods inherited from class org.htmlparser.nodes.AbstractNode
clone, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtml
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.htmlparser.Node
clone, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtml
 

Field Detail

mCode

protected String mCode
Script code if different from the page contents.

Constructor Detail

ScriptTag

public ScriptTag()
Create a new script tag.

Method Detail

getIds

public String[] getIds()
Return the set of names handled by this tag.

Specified by:
getIds in interface Tag
Overrides:
getIds in class TagNode
Returns:
The names to be matched that create tags of this type.

getEndTagEnders

public String[] getEndTagEnders()
Return the set of end tag names that cause this tag to finish.

Specified by:
getEndTagEnders in interface Tag
Overrides:
getEndTagEnders in class TagNode
Returns:
The names of following end tags that stop further scanning.

getLanguage

public String getLanguage()
Get the LANGUAGE attribute, if any.

Returns:
The scripting language.

getScriptCode

public String getScriptCode()
Get the script code. Normally this is the contents of the children, but in the rare case that the script is encoded, this is the plaintext decrypted code.

Returns:
The plaintext or overridden code contents of the tag.

setScriptCode

public void setScriptCode(String code)
Set the code contents.

Parameters:
code - The new code contents of this tag.

getType

public String getType()
Get the TYPE attribute, if any.

Returns:
The script mime type.

setLanguage

public void setLanguage(String language)
Set the language of the script tag.

Parameters:
language - The new language value.

setType

public void setType(String type)
Set the mime type of the script tag.

Parameters:
type - The new mime type.

putChildrenInto

protected void putChildrenInto(StringBuffer sb,
                               boolean verbatim)
Places the script contents into the provided buffer.

Overrides:
putChildrenInto in class CompositeTag
Parameters:
verbatim - If true return as close to the original page text as possible.
sb - The buffer to add the script to.

toString

public String toString()
Print the contents of the script tag suitable for debugging display.

Specified by:
toString in interface Node
Overrides:
toString in class CompositeTag
Returns:
The script language or type and code as a string.

© 2006 Derrick Oswald
Sep 17, 2006

HTML Parser is an open source library released under Common Public License. SourceForge.net