Class SaxParserHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- com.sun.enterprise.deployment.node.SaxParserHandler
-
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
SaxParserHandlerBundled
@Service @PerLookup public class SaxParserHandler extends DefaultHandler
This class implements all the callbacks for the SAX Parser in JAXP 1.1- Version:
- Author:
- Jerome Dochez
-
-
Field Summary
Fields Modifier and Type Field Description static StringJAXP_SCHEMA_LANGUAGEstatic StringJAXP_SCHEMA_SOURCEprotected StringpublicIDXMLNodetopNodestatic StringW3C_XML_SCHEMA
-
Constructor Summary
Constructors Constructor Description SaxParserHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int stop)voidendElement(String uri, String localName, String qName)voiderror(SAXParseException spe)voidfatalError(SAXParseException spe)protected InputStreamgetDTDUrlFor(String dtdFileName)protected static Collection<String>getElementsAllowingEmptyValues()protected static Collection<String>getElementsPreservingWhiteSpace()protected static Map<String,String>getMapping()static FilegetSchemaFileFor(String schemaSystemID)static StringgetSchemaURLFor(String schemaSystemID)XMLNodegetTopNode()protected static List<VersionUpgrade>getVersionUpgrades(String key)voidnotationDecl(String name, String publicId, String systemId)static voidregisterBundleNode(BundleNode bn, String bundleTagName)InputSourceresolveEntity(String publicID, String systemID)static StringresolvePublicID(String publicID, String dtd)Determine whether the publicID starts with a known proprietary value.static StringresolveSchemaNamespace(String systemID)Determine whether the syatemID starts with a known namespace.voidsetErrorReportingString(String s)Sets the error reporting context stringvoidsetStopOnError(boolean stop)Sets if the parser should stop parsing and generate an SAXPArseException when the xml parsed contains errors in regards to validationvoidsetTopNode(XMLNode node)voidstartElement(String uri, String localName, String qName, Attributes attributes)voidstartPrefixMapping(String prefix, String uri)-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
JAXP_SCHEMA_LANGUAGE
public static final String JAXP_SCHEMA_LANGUAGE
- See Also:
- Constant Field Values
-
JAXP_SCHEMA_SOURCE
public static final String JAXP_SCHEMA_SOURCE
- See Also:
- Constant Field Values
-
W3C_XML_SCHEMA
public static final String W3C_XML_SCHEMA
- See Also:
- Constant Field Values
-
topNode
public XMLNode topNode
-
publicID
protected String publicID
-
-
Method Detail
-
getVersionUpgrades
protected static List<VersionUpgrade> getVersionUpgrades(String key)
-
getElementsAllowingEmptyValues
protected static Collection<String> getElementsAllowingEmptyValues()
-
getElementsPreservingWhiteSpace
protected static Collection<String> getElementsPreservingWhiteSpace()
-
registerBundleNode
public static void registerBundleNode(BundleNode bn, String bundleTagName)
-
resolveEntity
public InputSource resolveEntity(String publicID, String systemID) throws SAXException
- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler- Throws:
SAXException
-
setStopOnError
public void setStopOnError(boolean stop)
Sets if the parser should stop parsing and generate an SAXPArseException when the xml parsed contains errors in regards to validation
-
error
public void error(SAXParseException spe) throws SAXParseException
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXParseException
-
fatalError
public void fatalError(SAXParseException spe) throws SAXParseException
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
SAXParseException
-
getDTDUrlFor
protected InputStream getDTDUrlFor(String dtdFileName)
- Returns:
- the input stream for a DTD public ID
-
getSchemaURLFor
public static String getSchemaURLFor(String schemaSystemID) throws IOException
- Parameters:
schemaSystemID- the system id for the schema- Returns:
- an URL for the schema location for a schema indentified by the passed parameter
- Throws:
IOException
-
getSchemaFileFor
public static File getSchemaFileFor(String schemaSystemID) throws IOException
- Parameters:
schemaSystemID- the system id for the schema- Returns:
- a File pointer to the localtion of the schema indentified by the passed parameter
- Throws:
IOException
-
resolveSchemaNamespace
public static String resolveSchemaNamespace(String systemID)
Determine whether the syatemID starts with a known namespace. If so, strip off that namespace and return the rest. Otherwise, return null- Parameters:
systemID- The systemID to examine- Returns:
- the part if the namespace to find in the file system or null if the systemID does not start with a known namespace
-
resolvePublicID
public static String resolvePublicID(String publicID, String dtd)
Determine whether the publicID starts with a known proprietary value. If so, strip off that value and return the rest. Otherwise, return null- Parameters:
publicID- The publicID to examine- Returns:
- the part if the namespace to find in the file system or null if the publicID does not start with a known namespace
-
notationDecl
public void notationDecl(String name, String publicId, String systemId) throws SAXException
- Specified by:
notationDeclin interfaceDTDHandler- Overrides:
notationDeclin classDefaultHandler- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes)
- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-
endElement
public void endElement(String uri, String localName, String qName)
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
characters
public void characters(char[] ch, int start, int stop)- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
getTopNode
public XMLNode getTopNode()
-
setTopNode
public void setTopNode(XMLNode node)
-
setErrorReportingString
public void setErrorReportingString(String s)
Sets the error reporting context string
-
-