org.util.xml.parse.policy
Class DefaultParserPolicy

java.lang.Object
  extended by org.util.xml.parse.policy.DefaultParserPolicy
All Implemented Interfaces:
ParserPolicy
Direct Known Subclasses:
HTMLParserPolicy, XMLParserPolicy

public class DefaultParserPolicy
extends java.lang.Object
implements ParserPolicy

Author:
masaru

Constructor Summary
DefaultParserPolicy()
           
 
Method Summary
 Element allowElement(Element element)
          called when element is detected.
 boolean checkEndTag()
          if true, check open tag key and close tag key.
 boolean finished()
           
 boolean forceEmptyTag(java.lang.String key)
          Basicly, all the tag must open and close.
 ParserPolicy getInnerPolicy(Element element)
          return handler that handle this element
 java.lang.String selectEncoding(java.lang.String last_tag_key)
          if encoding cannot be detected by first line of document, this method will be called.
 boolean throwExceptionIfDocumentHasError()
          Throw exception if document has error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultParserPolicy

public DefaultParserPolicy()
Method Detail

throwExceptionIfDocumentHasError

public boolean throwExceptionIfDocumentHasError()
Description copied from interface: ParserPolicy
Throw exception if document has error. In case this method returns false, if there are errors, skip some texts and continue parsing.

Specified by:
throwExceptionIfDocumentHasError in interface ParserPolicy

checkEndTag

public boolean checkEndTag()
Description copied from interface: ParserPolicy
if true, check open tag key and close tag key.

Specified by:
checkEndTag in interface ParserPolicy

selectEncoding

public java.lang.String selectEncoding(java.lang.String last_tag_key)
Description copied from interface: ParserPolicy
if encoding cannot be detected by first line of document, this method will be called. while returned null, this method will be called every time that tag detected.

Specified by:
selectEncoding in interface ParserPolicy

forceEmptyTag

public boolean forceEmptyTag(java.lang.String key)
Description copied from interface: ParserPolicy
Basicly, all the tag must open and close. But if this method return true, opentag will be considerd to empty tag. So end tag will disregarded.

Specified by:
forceEmptyTag in interface ParserPolicy

getInnerPolicy

public ParserPolicy getInnerPolicy(Element element)
Description copied from interface: ParserPolicy
return handler that handle this element

Specified by:
getInnerPolicy in interface ParserPolicy

allowElement

public Element allowElement(Element element)
Description copied from interface: ParserPolicy
called when element is detected.

Specified by:
allowElement in interface ParserPolicy

finished

public boolean finished()
Specified by:
finished in interface ParserPolicy