001 /* 002 * To change this template, choose Tools | Templates 003 * and open the template in the editor. 004 */ 005 006 package org.util.xml.parse.policy; 007 008 import org.util.xml.element.Element; 009 010 /** 011 * 012 * @author masaru 013 */ 014 public interface ParserPolicy { 015 016 /** 017 * Throw exception if document has error. 018 * In case this method returns false, if there are errors, skip some texts and continue parsing. 019 */ 020 public boolean throwExceptionIfDocumentHasError(); 021 022 /** 023 * if true, check open tag key and close tag key. 024 */ 025 public boolean checkEndTag(); 026 027 /** 028 * if encoding cannot be detected by first line of document, this method will be called. 029 * while returned null, this method will be called every time that tag detected. 030 */ 031 public String selectEncoding(String last_tag_key); 032 033 /** 034 * Basicly, all the tag must open and close. 035 * But if this method return true, opentag will be considerd to empty tag. So end tag will disregarded. 036 */ 037 public boolean forceEmptyTag(String key); 038 039 //public boolean allowTagSize(); 040 041 /** 042 * return handler that handle this element 043 */ 044 public ParserPolicy getInnerPolicy(Element element); 045 046 /** 047 * called when element is detected. 048 */ 049 public Element allowElement(Element element); 050 051 public boolean finished(); 052 }