public class XMLParserUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACES_SAXF |
static java.lang.String |
SCHEMA_V_XERCESF |
static java.lang.String |
VALIDATION_SAXF |
Constructor and Description |
---|
XMLParserUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addExternalSchemaURL(org.apache.xerces.parsers.DOMParser dp,
java.lang.String namespace,
java.lang.String u)
Add a namespace/URL pair to the mapping between namespaces and the schemas used
to validate elements in them.
|
static void |
addExternalSchemaURL(org.xml.sax.XMLReader xr,
java.lang.String namespace,
java.lang.String u)
Add a namespace/URL pair to the mapping between namespaces and the schemas used
to validate elements in them.
|
static javax.xml.parsers.DocumentBuilderFactory |
getDocumentBuilderFactory()
Get the 'correct' implementation of a JAXP
DocumentBuilderFactory ;
this is intended to ensure that local implementations (e.g., Crimson) don't
sneak into the mix. |
static org.apache.xerces.parsers.DOMParser |
getDOMParser() |
static javax.xml.parsers.SAXParserFactory |
getSAXParserFactory()
Get the 'correct' implementation of a JAXP
SAXParserFactory ; this is
intended to ensure that local implementations (e.g., Crimson) don't sneak into
the mix. |
static org.xml.sax.ContentHandler |
getXercesSerializer(java.io.OutputStream os) |
static org.xml.sax.XMLReader |
getXMLReader() |
static void |
setExternalSchemaURL(org.apache.xerces.parsers.DOMParser dp,
java.lang.String namespace,
java.lang.String u)
Specify an external schema location and turn on validation via setting features
and properties.
|
static void |
setExternalSchemaURL(org.xml.sax.XMLReader xr,
java.lang.String namespace,
java.lang.String u)
Specify an external schema location and turn on validation via setting features
and properties.
|
static void |
setNamespaces(org.xml.sax.XMLReader xr)
Set the
namespaces SAX property on the supplied
XMLReader . |
public static final java.lang.String NAMESPACES_SAXF
public static final java.lang.String VALIDATION_SAXF
public static final java.lang.String SCHEMA_V_XERCESF
public static javax.xml.parsers.SAXParserFactory getSAXParserFactory()
Get the 'correct' implementation of a JAXP SAXParserFactory
; this is
intended to ensure that local implementations (e.g., Crimson) don't sneak into
the mix.
public static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
Get the 'correct' implementation of a JAXP DocumentBuilderFactory
;
this is intended to ensure that local implementations (e.g., Crimson) don't
sneak into the mix.
public static void setNamespaces(org.xml.sax.XMLReader xr)
namespaces
SAX property on the supplied
XMLReader
.xr
- the XMLReader
to apply the feature to.public static org.xml.sax.XMLReader getXMLReader()
XMLReader
instance.public static org.apache.xerces.parsers.DOMParser getDOMParser()
public static void setExternalSchemaURL(org.xml.sax.XMLReader xr, java.lang.String namespace, java.lang.String u) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
Specify an external schema location and turn on validation via setting features and properties.
xr
- the XMLReader to apply the features and properties to.namespace
- the namespace URI of the schema to validate, with the empty
string or null
serving to represent the empty namespace.u
- the URL (or relative URL) that contains the schema.org.xml.sax.SAXNotSupportedException
- if one of the underlying feature/property
settings does.org.xml.sax.SAXNotRecognizedException
- if one of the underlying feature/property
settings does.public static void setExternalSchemaURL(org.apache.xerces.parsers.DOMParser dp, java.lang.String namespace, java.lang.String u) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
Specify an external schema location and turn on validation via setting features and properties.
dp
- the DOMParser
to apply the features and properties to.namespace
- the namespace URI of the schema to validate, with the empty
string or null
serving to represent the empty namespace.u
- the URL or relative URL that contains the schema.org.xml.sax.SAXNotSupportedException
- if one of the underlying feature/property
settings does.org.xml.sax.SAXNotRecognizedException
- if one of the underlying feature/property
settings does.public static void addExternalSchemaURL(org.xml.sax.XMLReader xr, java.lang.String namespace, java.lang.String u) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
Add a namespace/URL pair to the mapping between namespaces and the schemas used to validate elements in them. Adding a pair for a namespace that's already bound will result in overwriting the URL previously bound.
xr
- namespace
- u
- org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public static void addExternalSchemaURL(org.apache.xerces.parsers.DOMParser dp, java.lang.String namespace, java.lang.String u) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
Add a namespace/URL pair to the mapping between namespaces and the schemas used to validate elements in them. Adding a pair for a namespace that's already bound will result in overwriting the URL previously bound.
dp
- the DOMParser
to apply the features and properties to.namespace
- the namespace URI of the schema to validate, with the empty
string or null
serving to represent the empty namespace.u
- the URL or relative URL that contains the schema.org.xml.sax.SAXNotSupportedException
- if one of the underlying feature/property
settings does.org.xml.sax.SAXNotRecognizedException
- if one of the underlying feature/property
settings does.public static org.xml.sax.ContentHandler getXercesSerializer(java.io.OutputStream os)