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
public class XmlLoader extends 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlLoader.LoadExternalDtdFeatureProvider
Used for setting specific for secure java installations features to SAXParserFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static XMLReader
createXmlReader(DefaultHandler handler)
Helper method to createXMLReader
.void
error(SAXParseException exception)
void
parseInputSource(InputSource inputSource)
Parses the specified input source.InputSource
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
-
-
-
-
Constructor Detail
-
XmlLoader
protected XmlLoader(Map<String,String> publicIdToResourceNameMap) throws SAXException, ParserConfigurationException
Creates a new instance.- Parameters:
publicIdToResourceNameMap
- maps public IDs to DTD resource names- Throws:
SAXException
- if an error occursParserConfigurationException
- if an error occurs
-
-
Method Detail
-
parseInputSource
public void parseInputSource(InputSource inputSource) throws IOException, SAXException
Parses the specified input source.- Parameters:
inputSource
- the input source to parse.- Throws:
IOException
- if an error occursSAXException
- in an error occurs
-
resolveEntity
public InputSource resolveEntity(String publicId, String systemId)
- Specified by:
resolveEntity
in interfaceEntityResolver
- Overrides:
resolveEntity
in classDefaultHandler
-
error
public void error(SAXParseException exception) throws SAXException
- 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
-
-