nu.validator.xml
Class ContentTypeParser

java.lang.Object
  extended by nu.validator.xml.ContentTypeParser

public class ContentTypeParser
extends Object


Field Summary
private  boolean acceptAllKnownXmlTypes
           
private  boolean allowGenericXml
           
private  boolean allowHtml
           
private  boolean allowRnc
           
private  boolean allowXhtml
           
private static Pattern CHARSET
           
private  ErrorHandler errorHandler
           
private  boolean laxContentType
           
 
Constructor Summary
ContentTypeParser(ErrorHandler errorHandler, boolean laxContentType)
           
ContentTypeParser(ErrorHandler errorHandler, boolean laxContentType, boolean allowRnc, boolean allowHtml, boolean allowXhtml, boolean acceptAllKnownXmlTypes, boolean allowGenericXml)
           
 
Method Summary
 TypedInputSource buildTypedInputSource(String baseUri, String publicId, String contentType)
           
 boolean isAcceptAllKnownXmlTypes()
          Returns the acceptAllKnownXmlTypes.
 boolean isAllowGenericXml()
          Returns the allowGenericXml.
 boolean isAllowHtml()
          Returns the allowHtml.
 boolean isAllowRnc()
          Returns the allowRnc.
 boolean isAllowXhtml()
          Returns the allowXhtml.
 boolean isLaxContentType()
          Returns the laxContentType.
 boolean isOnlyHtmlAllowed()
           
protected  boolean rncContentType(String type, InputSource is)
           
 void setAcceptAllKnownXmlTypes(boolean acceptAllKnownXmlTypes)
          Sets the acceptAllKnownXmlTypes.
 void setAllowGenericXml(boolean allowGenericXml)
          Sets the allowGenericXml.
 void setAllowHtml(boolean allowHtml)
          Sets the allowHtml.
 void setAllowRnc(boolean allowRnc)
          Sets the allowRnc.
 void setAllowXhtml(boolean allowXhtml)
          Sets the allowXhtml.
 void setLaxContentType(boolean laxContentType)
          Sets the laxContentType.
protected  boolean xmlContentType(String type, InputSource is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET

private static final Pattern CHARSET

errorHandler

private final ErrorHandler errorHandler

laxContentType

private boolean laxContentType

allowRnc

private boolean allowRnc

allowHtml

private boolean allowHtml

allowXhtml

private boolean allowXhtml

acceptAllKnownXmlTypes

private boolean acceptAllKnownXmlTypes

allowGenericXml

private boolean allowGenericXml
Constructor Detail

ContentTypeParser

public ContentTypeParser(ErrorHandler errorHandler,
                         boolean laxContentType,
                         boolean allowRnc,
                         boolean allowHtml,
                         boolean allowXhtml,
                         boolean acceptAllKnownXmlTypes,
                         boolean allowGenericXml)
Parameters:
errorHandler -
laxContentType -
allowRnc -
allowHtml -
allowXhtml -
acceptAllKnownXmlTypes -
allowGenericXml -

ContentTypeParser

public ContentTypeParser(ErrorHandler errorHandler,
                         boolean laxContentType)
Method Detail

xmlContentType

protected boolean xmlContentType(String type,
                                 InputSource is)
                          throws SAXException
Throws:
SAXException

rncContentType

protected boolean rncContentType(String type,
                                 InputSource is)
                          throws SAXException
Throws:
SAXException

buildTypedInputSource

public TypedInputSource buildTypedInputSource(String baseUri,
                                              String publicId,
                                              String contentType)
                                       throws SAXException,
                                              SAXParseException
Parameters:
baseUri -
publicId -
contentType -
Returns:
Throws:
SAXException
SAXParseException

isAcceptAllKnownXmlTypes

public boolean isAcceptAllKnownXmlTypes()
Returns the acceptAllKnownXmlTypes.

Returns:
the acceptAllKnownXmlTypes

setAcceptAllKnownXmlTypes

public void setAcceptAllKnownXmlTypes(boolean acceptAllKnownXmlTypes)
Sets the acceptAllKnownXmlTypes.

Parameters:
acceptAllKnownXmlTypes - the acceptAllKnownXmlTypes to set

isAllowGenericXml

public boolean isAllowGenericXml()
Returns the allowGenericXml.

Returns:
the allowGenericXml

setAllowGenericXml

public void setAllowGenericXml(boolean allowGenericXml)
Sets the allowGenericXml.

Parameters:
allowGenericXml - the allowGenericXml to set

isAllowHtml

public boolean isAllowHtml()
Returns the allowHtml.

Returns:
the allowHtml

setAllowHtml

public void setAllowHtml(boolean allowHtml)
Sets the allowHtml.

Parameters:
allowHtml - the allowHtml to set

isAllowRnc

public boolean isAllowRnc()
Returns the allowRnc.

Returns:
the allowRnc

setAllowRnc

public void setAllowRnc(boolean allowRnc)
Sets the allowRnc.

Parameters:
allowRnc - the allowRnc to set

isAllowXhtml

public boolean isAllowXhtml()
Returns the allowXhtml.

Returns:
the allowXhtml

setAllowXhtml

public void setAllowXhtml(boolean allowXhtml)
Sets the allowXhtml.

Parameters:
allowXhtml - the allowXhtml to set

isLaxContentType

public boolean isLaxContentType()
Returns the laxContentType.

Returns:
the laxContentType

setLaxContentType

public void setLaxContentType(boolean laxContentType)
Sets the laxContentType.

Parameters:
laxContentType - the laxContentType to set

isOnlyHtmlAllowed

public boolean isOnlyHtmlAllowed()