Class HTMLParser
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconvertCharEntity(String charEntity) Overrides XMLParser.convertCharEntity to add in HTML char entitiesprotected ElementcreateNewElement(String name) Overrides XMLParser.createNewElement to return an HTMLElement instanceprotected ElementcreateNewTextElement(String text) Overrides XMLParser.createNewTextElement to return an HTMLElement instanceprotected String{Returns a string identifying the document type this parser supports.protected booleanisEmptyTag(String tagName) Checks whether the specified tag is an empty tag as defined in EMPTY_TAGSprotected booleanisSupported(Element element) Overrides the Element.isSupported to let the parser know which tags are supported in XHTML-MP 1.0A convenience method that casts the returned type of the parse method to HTMLElement.protected voidparseTagContent(Element element, Reader is) Overrides XMLParser.parseTagContent to enable embedded CSS segments (Style tags)protected booleanshouldEvaluate(Element element) Overrides the Element.shouldEvaluate method to return false on the script tag.Methods inherited from class XMLParser
addCharEntitiesRange, addCharEntity, attribute, endTag, eventParser, isCaseSensitive, isWhiteSpace, notifyError, parse, parseCommentOrXMLDeclaration, parseTag, setCaseSensitive, setIncludeWhitespacesBetweenTags, setParserCallback, startTag, textElement
-
Constructor Details
-
HTMLParser
public HTMLParser()Constructs a new instance of HTMLParser
-
-
Method Details
-
parseTagContent
Overrides XMLParser.parseTagContent to enable embedded CSS segments (Style tags)
Parameters
-
element: The current parent element -
is: The reader containing the XML
Throws
IOException: if an I/O error in the stream is encountered
- Overrides:
parseTagContentin classXMLParser- Throws:
IOException
-
-
createNewElement
Overrides XMLParser.createNewElement to return an HTMLElement instance
Parameters
name: The HTMLElement's name
Returns
a new instance of the names HTMLElement
- Overrides:
createNewElementin classXMLParser
-
createNewTextElement
Overrides XMLParser.createNewTextElement to return an HTMLElement instance
Parameters
text: The HTMLElement's text
Returns
a new instance of the HTMLElement
- Overrides:
createNewTextElementin classXMLParser
-
convertCharEntity
Overrides XMLParser.convertCharEntity to add in HTML char entities
Parameters
charEntity: The char entity to convert
Returns
A string containing a single char, or the original char entity string (with & and ;) if the char entity couldn't be resolved
- Overrides:
convertCharEntityin classXMLParser
-
isEmptyTag
Checks whether the specified tag is an empty tag as defined in EMPTY_TAGS
Parameters
tagName: The tag name to check
Returns
true if that tag is defined as an empty tag, false otherwise
- Overrides:
isEmptyTagin classXMLParser
-
parseHTML
A convenience method that casts the returned type of the parse method to HTMLElement. Basically calling this method is simlar to calling parse and casting to HTMLElement.
Parameters
isr: The input stream containing the HTML
Returns
The HTML document
-
getSupportedStandardName
{
Returns a string identifying the document type this parser supports. This should be overriden by subclassing parsers.
Returns
a string identifying the document type this parser supports.
}- Overrides:
getSupportedStandardNamein classXMLParser
-
isSupported
Overrides the Element.isSupported to let the parser know which tags are supported in XHTML-MP 1.0
Returns
true if the tag is a supported XHTML Mobile Profile 1.0 tag, false otherwise
- Overrides:
isSupportedin classXMLParser
-
shouldEvaluate
Overrides the Element.shouldEvaluate method to return false on the script tag. The script tag should be skipped entirely, since it may contain characters like greater-than and lesser-than which may break the HTML All other tags are evaluated (i.e. added including all their children to the tree), even if not supported (But of course their functionality is ignored by HTMLComponent)
Returns
false if this is the SCRIPT tag, true otherwise
- Overrides:
shouldEvaluatein classXMLParser
-