public class ParserUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String[] |
CACHED_DTD_PUBLIC_IDS
List of the Public IDs that we cache, and their
associated location.
|
(package private) static java.lang.String[] |
CACHED_DTD_RESOURCE_PATHS |
(package private) static java.lang.String[] |
CACHED_SCHEMA_RESOURCE_PATHS |
private static java.lang.String[] |
DEFAULT_DTD_RESOURCE_PATHS |
private static java.lang.String[] |
DEFAULT_SCHEMA_RESOURCE_PATHS |
(package private) static java.lang.String |
dtdResourcePrefix |
(package private) static org.xml.sax.EntityResolver |
entityResolver
An entity resolver for use when parsing XML documents.
|
private static org.xml.sax.ErrorHandler |
errorHandler
An error handler for use when parsing XML documents.
|
(package private) static boolean |
isDtdResourcePrefixFileUrl |
(package private) static boolean |
isSchemaResourcePrefixFileUrl |
(package private) static java.util.logging.Logger |
log |
private static java.lang.String |
SCHEMA_LOCATION_ATTR |
private static java.util.HashMap<java.lang.String,javax.xml.validation.Schema> |
schemaCache |
(package private) static java.lang.String |
schemaResourcePrefix |
Constructor and Description |
---|
ParserUtils() |
ParserUtils(boolean blockExternal) |
Modifier and Type | Method and Description |
---|---|
protected TreeNode |
convert(TreeNode parent,
org.w3c.dom.Node node)
Create and return a TreeNode that corresponds to the specified Node,
including processing all of the attributes and children nodes.
|
private static javax.xml.validation.Schema |
getSchema(org.w3c.dom.Document document) |
private static javax.xml.validation.Schema |
getSchema(java.lang.String schemaPublicId) |
TreeNode |
parseXMLDocument(java.lang.String uri,
org.xml.sax.InputSource is)
Parse the specified XML document, and return a
TreeNode
that corresponds to the root node of the document tree. |
TreeNode |
parseXMLDocument(java.lang.String uri,
org.xml.sax.InputSource is,
boolean validate)
Parse the specified XML document, and return a
TreeNode
that corresponds to the root node of the document tree. |
TreeNode |
parseXMLDocument(java.lang.String uri,
java.io.InputStream is)
Parse the specified XML document, and return a
TreeNode
that corresponds to the root node of the document tree. |
TreeNode |
parseXMLDocument(java.lang.String uri,
java.io.InputStream is,
boolean validate)
Parse the specified XML document, and return a
TreeNode
that corresponds to the root node of the document tree. |
static void |
setDtdResourcePrefix(java.lang.String prefix)
Sets the path prefix URL for .dtd resources
|
static void |
setEntityResolver(org.xml.sax.EntityResolver er) |
static void |
setSchemaResourcePrefix(java.lang.String prefix)
Sets the path prefix URL for .xsd resources
|
private static java.lang.String |
uencode(java.lang.String prefix) |
static java.util.logging.Logger log
private static org.xml.sax.ErrorHandler errorHandler
static org.xml.sax.EntityResolver entityResolver
static java.lang.String schemaResourcePrefix
static java.lang.String dtdResourcePrefix
static boolean isDtdResourcePrefixFileUrl
static boolean isSchemaResourcePrefixFileUrl
private static final java.lang.String SCHEMA_LOCATION_ATTR
private static java.util.HashMap<java.lang.String,javax.xml.validation.Schema> schemaCache
static final java.lang.String[] CACHED_DTD_PUBLIC_IDS
private static final java.lang.String[] DEFAULT_DTD_RESOURCE_PATHS
static final java.lang.String[] CACHED_DTD_RESOURCE_PATHS
private static final java.lang.String[] DEFAULT_SCHEMA_RESOURCE_PATHS
static final java.lang.String[] CACHED_SCHEMA_RESOURCE_PATHS
public ParserUtils()
public ParserUtils(boolean blockExternal)
public static void setEntityResolver(org.xml.sax.EntityResolver er)
public static void setSchemaResourcePrefix(java.lang.String prefix)
public static void setDtdResourcePrefix(java.lang.String prefix)
private static java.lang.String uencode(java.lang.String prefix)
public TreeNode parseXMLDocument(java.lang.String uri, org.xml.sax.InputSource is) throws JasperException
TreeNode
that corresponds to the root node of the document tree.uri
- URI of the XML document being parsedis
- Input source containing the deployment descriptorJasperException
- if an I/O or parsing error has occurredpublic TreeNode parseXMLDocument(java.lang.String uri, org.xml.sax.InputSource is, boolean validate) throws JasperException
TreeNode
that corresponds to the root node of the document tree.uri
- URI of the XML document being parsedis
- Input source containing the deployment descriptorvalidate
- true if the XML document needs to be validated against
its DTD or schema, false otherwiseJasperException
- if an I/O or parsing error has occurredpublic TreeNode parseXMLDocument(java.lang.String uri, java.io.InputStream is) throws JasperException
TreeNode
that corresponds to the root node of the document tree.uri
- URI of the XML document being parsedis
- Input stream containing the deployment descriptorJasperException
- if an I/O or parsing error has occurredpublic TreeNode parseXMLDocument(java.lang.String uri, java.io.InputStream is, boolean validate) throws JasperException
TreeNode
that corresponds to the root node of the document tree.uri
- URI of the XML document being parsedis
- Input stream containing the deployment descriptorvalidate
- true if the XML document needs to be validated against
its DTD or schema, false otherwiseJasperException
- if an I/O or parsing error has occurredprotected TreeNode convert(TreeNode parent, org.w3c.dom.Node node)
parent
- The parent TreeNode (if any) for the new TreeNodenode
- The XML document Node to be convertedprivate static javax.xml.validation.Schema getSchema(org.w3c.dom.Document document) throws org.xml.sax.SAXException, JasperException
org.xml.sax.SAXException
JasperException
private static javax.xml.validation.Schema getSchema(java.lang.String schemaPublicId) throws org.xml.sax.SAXException
org.xml.sax.SAXException