Class AbstractLoader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- com.puppycrawl.tools.checkstyle.api.AbstractLoader
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
- Direct Known Subclasses:
ConfigurationLoader.InternalLoader
,ImportControlLoader
,PackageNamesLoader
,SuppressionsLoader
public abstract class AbstractLoader extends org.xml.sax.helpers.DefaultHandler
Contains the common implementation of a loader, for loading a configuration from an XML file.The error handling policy can be described as being austere, dead set, disciplinary, dour, draconian, exacting, firm, forbidding, grim, hard, hard- boiled, harsh, harsh, in line, iron-fisted, no-nonsense, oppressive, persnickety, picky, prudish, punctilious, puritanical, rigid, rigorous, scrupulous, set, severe, square, stern, stickler, straight, strait-laced, stringent, stuffy, stuffy, tough, unpermissive, unsparing and uptight.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
EXTERNAL_GENERAL_ENTITIES
Feature that enables including external general entities in XML files.private static java.lang.String
LOAD_EXTERNAL_DTD
Feature that enables loading external DTD when loading XML files.private org.xml.sax.XMLReader
parser
Parser to read XML files.private java.util.Map<java.lang.String,java.lang.String>
publicIdToResourceNameMap
Maps public id to resolve to resource name for the DTD.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLoader(java.lang.String publicId, java.lang.String dtdResourceName)
Creates a new instance.protected
AbstractLoader(java.util.Map<java.lang.String,java.lang.String> publicIdToResourceNameMap)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
error(org.xml.sax.SAXParseException exception)
void
fatalError(org.xml.sax.SAXParseException exception)
void
parseInputSource(org.xml.sax.InputSource inputSource)
Parses the specified input source.org.xml.sax.InputSource
resolveEntity(java.lang.String publicId, java.lang.String systemId)
-
-
-
Field Detail
-
LOAD_EXTERNAL_DTD
private static final java.lang.String LOAD_EXTERNAL_DTD
Feature that enables loading external DTD when loading XML files.- See Also:
- Constant Field Values
-
EXTERNAL_GENERAL_ENTITIES
private static final java.lang.String EXTERNAL_GENERAL_ENTITIES
Feature that enables including external general entities in XML files.- See Also:
- Constant Field Values
-
publicIdToResourceNameMap
private final java.util.Map<java.lang.String,java.lang.String> publicIdToResourceNameMap
Maps public id to resolve to resource name for the DTD.
-
parser
private final org.xml.sax.XMLReader parser
Parser to read XML files.
-
-
Constructor Detail
-
AbstractLoader
protected AbstractLoader(java.lang.String publicId, java.lang.String dtdResourceName) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
Creates a new instance.- Parameters:
publicId
- the public ID for the DTD to resolvedtdResourceName
- the resource for the DTD- Throws:
org.xml.sax.SAXException
- if an error occursjavax.xml.parsers.ParserConfigurationException
- if an error occurs
-
AbstractLoader
protected AbstractLoader(java.util.Map<java.lang.String,java.lang.String> publicIdToResourceNameMap) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException
Creates a new instance.- Parameters:
publicIdToResourceNameMap
- maps public IDs to DTD resource names- Throws:
org.xml.sax.SAXException
- if an error occursjavax.xml.parsers.ParserConfigurationException
- if an error occurs
-
-
Method Detail
-
parseInputSource
public void parseInputSource(org.xml.sax.InputSource inputSource) throws java.io.IOException, org.xml.sax.SAXException
Parses the specified input source.- Parameters:
inputSource
- the input source to parse.- Throws:
java.io.IOException
- if an error occursorg.xml.sax.SAXException
- in an error occurs
-
resolveEntity
public org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException
- Specified by:
resolveEntity
in interfaceorg.xml.sax.EntityResolver
- Overrides:
resolveEntity
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
java.io.IOException
-
error
public void error(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
- Specified by:
error
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
error
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
fatalError
public void fatalError(org.xml.sax.SAXParseException exception) throws org.xml.sax.SAXException
- Specified by:
fatalError
in interfaceorg.xml.sax.ErrorHandler
- Overrides:
fatalError
in classorg.xml.sax.helpers.DefaultHandler
- Throws:
org.xml.sax.SAXException
-
-