Package com.puppycrawl.tools.checkstyle
Class XmlLoader
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.puppycrawl.tools.checkstyle.XmlLoader
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
ConfigurationLoader.InternalLoader
,ImportControlLoader
,PackageNamesLoader
,SuppressionsLoader
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Used for setting specific for secure java installations features to SAXParserFactory. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static XMLReader
createXmlReader
(DefaultHandler handler) Helper method to createXMLReader
.void
error
(SAXParseException exception) void
parseInputSource
(InputSource inputSource) Parses the specified input source.resolveEntity
(String publicId, String systemId) Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
-
Field Details
-
publicIdToResourceNameMap
Maps public id to resolve to resource name for the DTD. -
parser
Parser to read XML files.
-
-
Constructor Details
-
XmlLoader
protected XmlLoader(Map<String, String> publicIdToResourceNameMap) throws SAXException, ParserConfigurationExceptionCreates a new instance.- Parameters:
publicIdToResourceNameMap
- maps public IDs to DTD resource names- Throws:
SAXException
- if an error occursParserConfigurationException
- if an error occurs
-
-
Method Details
-
parseInputSource
Parses the specified input source.- Parameters:
inputSource
- the input source to parse.- Throws:
IOException
- if an error occursSAXException
- in an error occurs
-
resolveEntity
- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
-
error
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
createXmlReader
private static XMLReader createXmlReader(DefaultHandler handler) throws SAXException, ParserConfigurationException Helper method to createXMLReader
.- Parameters:
handler
- the content handler- Returns:
- new XMLReader instance
- Throws:
ParserConfigurationException
- if a parser cannot be createdSAXException
- for SAX errors
-