APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.xml.internal

public Class JdkXmlUtils

extends Object
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl, com.sun.org.apache.xerces.internal.impl.Constants, com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl, .SAXParserFactoryImpl, com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings, com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager, .XMLConfigurationException, java.util.Map, javax.xml.XMLConstants, javax.xml.catalog.CatalogFeatures, .CatalogFeatures.Feature, javax.xml.parsers.DocumentBuilderFactory, .ParserConfigurationException, .SAXParserFactory, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.sax.SAXTransformerFactory, org.w3c.dom.Document, org.xml.sax.SAXException, .SAXNotRecognizedException, .SAXNotSupportedException, .XMLReader

Constants for use across JAXP processors.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
JdkXmlUtils.DefaultSAXFactory

The system-default factory

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final String
public static final String
private static final String
public static final boolean
public static final String
public static final String
public static final String
NAMESPACES_FEATURE

Xerces features

public static final String
public static final String
public static final String
private static final String
private static final String
private static final String
SECURITY_MANAGER

Property identifier: security manager.

public static final String
public static final String
USE_CATALOG

Catalog features

public static final boolean
USE_CATALOG_DEFAULT

Default value of USE_CATALOG.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static void
catalogFeaturesConfig2Config(XMLComponentManager
a Xerces configuration object
config1
,
ParserConfigurationSettings
a Xerces configuration object
config2
)

Passing on the CatalogFeatures settings from one Xerces configuration object to another.

public static void
catalogFeaturesConfig2Reader(XMLComponentManager
a Xerces configuration object
config
,
XMLReader
an XMLReader
reader
)

Passing on the CatalogFeatures settings from a Xerces configuration object to an XMLReader.

public static String

Returns:

the value of a Catalog feature, null if the name does not match any feature supported by the Catalog.
getCatalogFeature
(CatalogFeatures
a CatalogFeatures instance
features
,
String
the name of a Catalog feature
name
)

Returns the value of a Catalog feature by the property name.

public static CatalogFeatures

Returns:

an instance of a CatalogFeatures
getCatalogFeatures
()

Creates an instance of a CatalogFeatures with default settings.

public static CatalogFeatures

Returns:

a javax.xml.transform.Source object
getCatalogFeatures
(String
the defer property defined in CatalogFeatures
defer
,
String
the file path to a catalog
file
,
String
the prefer property defined in CatalogFeatures
prefer
,
String
the resolve property defined in CatalogFeatures
resolve
)

Creates an instance of a CatalogFeatures.

public static Document

Returns:

a DOM Document instance
getDOMDocument
()

Creates a system-default DOM Document.

public static DocumentBuilderFactory

Returns:

a DocumentBuilderFactory instance.
getDOMFactory
(boolean
a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.
overrideDefaultParser
)

Returns a DocumentBuilderFactory instance.

public static DocumentBuilderFactory

Returns:

a DocumentBuilderFactory instance
getDOMFactory
(boolean
a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.
overrideDefaultParser
,
XMLSecurityManager
XMLSecurityManager
xsm
,
XMLSecurityPropertyManager
XMLSecurityPropertyManager
xspm
)

Returns a DocumentBuilderFactory instance.

public static String

Returns:

a DTD external declaration
getDTDExternalDecl
(String
the public identifier
publicId
,
String
the system identifier
systemId
)

Returns the external declaration for a DTD construct.

public static String

Returns:

the value of the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager, null otherwise
getProperty
(XMLSecurityManager
the XMLSecurityManager
xsm
,
XMLSecurityPropertyManager
the XMLSecurityPropertyManager
xspm
,
String
the property
property
)

Returns the value of the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager.

public static SAXParserFactory

Returns:

a SAXParserFactory instance.
getSAXFactory
(boolean
a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.
overrideDefaultParser
)

Returns a SAXParserFactory instance.

public static SAXTransformerFactory

Returns:

an instance of SAXTransformerFactory
getSAXTransformFactory
(XMLSecurityManager
the XMLSecurityManager
sm
,
boolean
the setting of the OVERRIDE_PARSER property
overrideDefaultParser
)

Returns an instance of SAXTransformerFactory with the current XMLSecurityManager and the setting of the OVERRIDE_PARSER property.

public static int

Returns:

the value, or the default value if the value is null
getValue
(Object
the specified value
value
,
int
the default value
defValue
)

Returns the value.

public static XMLReader

Returns:

an XMLReader instance
getXMLReader
(XMLSecurityManager
the XMLSecurityManager
sm
,
boolean
a flag indicating whether a 3rd party's parser implementation may be used to override the system-default one
overrideDefaultParser
,
boolean
a flag indicating whether secure processing is requested
secureProcessing
,
boolean
a flag indicating whether Catalog is enabled
useCatalog
,
CatalogFeatures
the CatalogFeatures
catalogFeatures
)

Returns an XMLReader instance.

private static XMLReader
getXMLReaderWSAXFactory(boolean overrideDefaultParser)

private static XMLReader
public static void
initCatalogFeatures(Map<String, Object>
the Map object that holds the properties
properties
)

Initialize catalog features, including setting the default values and reading from the JAXP configuration file and System Properties.

public static boolean

Returns:

true if the RESOLVE feature is
isResolveContinue
(CatalogFeatures
the specified CatalogFeatures
cf
)

Checks whether the RESOLVE feature in the CatalogFeatures is continue.

private static String

Returns:

the quoted string
quoteString
(String
the input string, can not be null
s
)

Returns the input string quoted with double quotes or single ones if there is a double quote in the string.

public static boolean

Returns:

true if the property is managed by either XMLSecurityManager or XMLSecurityPropertyManager, false otherwise
setProperty
(XMLSecurityManager
the XMLSecurityManager
xsm
,
XMLSecurityPropertyManager
the XMLSecurityPropertyManager
xspm
,
String
the property
property
,
Object
the value
value
)

Sets the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager.

public static void
setReaderProperty(XMLReader
the XMLReader
reader
,
XMLSecurityManager
the XMLSecurityManager
sm
,
boolean
the USE_CATALOG property
useCatalog
,
CatalogFeatures
the Catalog features
catalogFeatures
)

Sets properties on the reader, including XMLSecurityManager and Catalog features.

public static void
setXMLReaderPropertyIfSupport(XMLReader
an XMLReader instance
reader
,
String
the name of the property
property
,
Object
the value of the property
value
,
boolean
a flag indicating whether a warning should be issued
warn
)

Sets the XMLReader instance with the specified property if the property is supported, ignores error if not, issues a warning if so requested.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CATALOG_DEFERback to summary
public static final String CATALOG_DEFER
CATALOG_FILESback to summary
public static final String CATALOG_FILES
CATALOG_PREFERback to summary
public static final String CATALOG_PREFER
CATALOG_RESOLVEback to summary
public static final String CATALOG_RESOLVE
DOM_FACTORY_IDback to summary
private static final String DOM_FACTORY_ID
IS_WINDOWSback to summary
public static final boolean IS_WINDOWS
JAVA_HOMEback to summary
public static final String JAVA_HOME
NAMESPACE_PREFIXES_FEATUREback to summary
public static final String NAMESPACE_PREFIXES_FEATURE
NAMESPACES_FEATUREback to summary
public static final String NAMESPACES_FEATURE

Xerces features

RESOLVE_CONTINUEback to summary
public static final String RESOLVE_CONTINUE
RESOLVE_IGNOREback to summary
public static final String RESOLVE_IGNORE
RESOLVE_STRICTback to summary
public static final String RESOLVE_STRICT
SAX_DRIVERback to summary
private static final String SAX_DRIVER
SAX_FACTORY_IDback to summary
private static final String SAX_FACTORY_ID
SECURITY_MANAGERback to summary
private static final String SECURITY_MANAGER

Property identifier: security manager.

SP_USE_CATALOGback to summary
public static final String SP_USE_CATALOG
USE_CATALOGback to summary
public static final String USE_CATALOG

Catalog features

USE_CATALOG_DEFAULTback to summary
public static final boolean USE_CATALOG_DEFAULT

Default value of USE_CATALOG. This will read the System property

Constructor Detail

JdkXmlUtilsback to summary
public JdkXmlUtils()

Method Detail

catalogFeaturesConfig2Configback to summary
public static void catalogFeaturesConfig2Config(XMLComponentManager config1, ParserConfigurationSettings config2)

Passing on the CatalogFeatures settings from one Xerces configuration object to another.

Parameters
config1:XMLComponentManager

a Xerces configuration object

config2:ParserConfigurationSettings

a Xerces configuration object

catalogFeaturesConfig2Readerback to summary
public static void catalogFeaturesConfig2Reader(XMLComponentManager config, XMLReader reader)

Passing on the CatalogFeatures settings from a Xerces configuration object to an XMLReader.

Parameters
config:XMLComponentManager

a Xerces configuration object

reader:XMLReader

an XMLReader

getCatalogFeatureback to summary
public static String getCatalogFeature(CatalogFeatures features, String name)

Returns the value of a Catalog feature by the property name.

Parameters
features:CatalogFeatures

a CatalogFeatures instance

name:String

the name of a Catalog feature

Returns:String

the value of a Catalog feature, null if the name does not match any feature supported by the Catalog.

getCatalogFeaturesback to summary
public static CatalogFeatures getCatalogFeatures()

Creates an instance of a CatalogFeatures with default settings.

Note

the CatalogFeatures is initialized with settings in the following order: Default values -> values in the config -> values set with System Properties

Returns:CatalogFeatures

an instance of a CatalogFeatures

getCatalogFeaturesback to summary
public static CatalogFeatures getCatalogFeatures(String defer, String file, String prefer, String resolve)

Creates an instance of a CatalogFeatures.

Parameters
defer:String

the defer property defined in CatalogFeatures

file:String

the file path to a catalog

prefer:String

the prefer property defined in CatalogFeatures

resolve:String

the resolve property defined in CatalogFeatures

Returns:CatalogFeatures

a javax.xml.transform.Source object

getDOMDocumentback to summary
public static Document getDOMDocument()

Creates a system-default DOM Document.

Returns:Document

a DOM Document instance

getDOMFactoryback to summary
public static DocumentBuilderFactory getDOMFactory(boolean overrideDefaultParser)

Returns a DocumentBuilderFactory instance.

Parameters
overrideDefaultParser:boolean

a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.

Returns:DocumentBuilderFactory

a DocumentBuilderFactory instance.

getDOMFactoryback to summary
public static DocumentBuilderFactory getDOMFactory(boolean overrideDefaultParser, XMLSecurityManager xsm, XMLSecurityPropertyManager xspm)

Returns a DocumentBuilderFactory instance.

Parameters
overrideDefaultParser:boolean

a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.

xsm:XMLSecurityManager

XMLSecurityManager

xspm:XMLSecurityPropertyManager

XMLSecurityPropertyManager

Returns:DocumentBuilderFactory

a DocumentBuilderFactory instance

getDTDExternalDeclback to summary
public static String getDTDExternalDecl(String publicId, String systemId)

Returns the external declaration for a DTD construct.

Parameters
publicId:String

the public identifier

systemId:String

the system identifier

Returns:String

a DTD external declaration

getPropertyback to summary
public static String getProperty(XMLSecurityManager xsm, XMLSecurityPropertyManager xspm, String property)

Returns the value of the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager.

Parameters
xsm:XMLSecurityManager

the XMLSecurityManager

xspm:XMLSecurityPropertyManager

the XMLSecurityPropertyManager

property:String

the property

Returns:String

the value of the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager, null otherwise

getSAXFactoryback to summary
public static SAXParserFactory getSAXFactory(boolean overrideDefaultParser)

Returns a SAXParserFactory instance.

Parameters
overrideDefaultParser:boolean

a flag indicating whether the system-default implementation may be overridden. If the system property of the DOM factory ID is set, override is always allowed.

Returns:SAXParserFactory

a SAXParserFactory instance.

getSAXTransformFactoryback to summary
public static SAXTransformerFactory getSAXTransformFactory(XMLSecurityManager sm, boolean overrideDefaultParser)

Returns an instance of SAXTransformerFactory with the current XMLSecurityManager and the setting of the OVERRIDE_PARSER property.

Parameters
sm:XMLSecurityManager

the XMLSecurityManager

overrideDefaultParser:boolean

the setting of the OVERRIDE_PARSER property

Returns:SAXTransformerFactory

an instance of SAXTransformerFactory

getValueback to summary
public static int getValue(Object value, int defValue)

Returns the value.

Parameters
value:Object

the specified value

defValue:int

the default value

Returns:int

the value, or the default value if the value is null

getXMLReaderback to summary
public static XMLReader getXMLReader(XMLSecurityManager sm, boolean overrideDefaultParser, boolean secureProcessing, boolean useCatalog, CatalogFeatures catalogFeatures)

Returns an XMLReader instance. If overrideDefaultParser is requested, use SAXParserFactory or XMLReaderFactory, otherwise use the system-default SAXParserFactory to locate an XMLReader.

Note

parameter useXMLReaderFactory was removed. The method instead checks the SAX_DRIVER property for whether the XMLReader should be created using XMLReaderFactory for compatibility. (see JDK-6490921).

Parameters
sm:XMLSecurityManager

the XMLSecurityManager

overrideDefaultParser:boolean

a flag indicating whether a 3rd party's parser implementation may be used to override the system-default one

secureProcessing:boolean

a flag indicating whether secure processing is requested

useCatalog:boolean

a flag indicating whether Catalog is enabled

catalogFeatures:CatalogFeatures

the CatalogFeatures

Returns:XMLReader

an XMLReader instance

getXMLReaderWSAXFactoryback to summary
private static XMLReader getXMLReaderWSAXFactory(boolean overrideDefaultParser)
getXMLReaderWXMLReaderFactoryback to summary
private static XMLReader getXMLReaderWXMLReaderFactory()
Annotations
@SuppressWarnings:deprecation
initCatalogFeaturesback to summary
public static void initCatalogFeatures(Map<String, Object> properties)

Initialize catalog features, including setting the default values and reading from the JAXP configuration file and System Properties.

Parameters
properties:Map<String, Object>

the Map object that holds the properties

isResolveContinueback to summary
public static boolean isResolveContinue(CatalogFeatures cf)

Checks whether the RESOLVE feature in the CatalogFeatures is continue.

Parameters
cf:CatalogFeatures

the specified CatalogFeatures

Returns:boolean

true if the RESOLVE feature is

quoteStringback to summary
private static String quoteString(String s)

Returns the input string quoted with double quotes or single ones if there is a double quote in the string.

Parameters
s:String

the input string, can not be null

Returns:String

the quoted string

setPropertyback to summary
public static boolean setProperty(XMLSecurityManager xsm, XMLSecurityPropertyManager xspm, String property, Object value)

Sets the property if it's managed by either XMLSecurityManager or XMLSecurityPropertyManager.

Parameters
xsm:XMLSecurityManager

the XMLSecurityManager

xspm:XMLSecurityPropertyManager

the XMLSecurityPropertyManager

property:String

the property

value:Object

the value

Returns:boolean

true if the property is managed by either XMLSecurityManager or XMLSecurityPropertyManager, false otherwise

setReaderPropertyback to summary
public static void setReaderProperty(XMLReader reader, XMLSecurityManager sm, boolean useCatalog, CatalogFeatures catalogFeatures)

Sets properties on the reader, including XMLSecurityManager and Catalog features.

Parameters
reader:XMLReader

the XMLReader

sm:XMLSecurityManager

the XMLSecurityManager

useCatalog:boolean

the USE_CATALOG property

catalogFeatures:CatalogFeatures

the Catalog features

setXMLReaderPropertyIfSupportback to summary
public static void setXMLReaderPropertyIfSupport(XMLReader reader, String property, Object value, boolean warn)

Sets the XMLReader instance with the specified property if the property is supported, ignores error if not, issues a warning if so requested.

Parameters
reader:XMLReader

an XMLReader instance

property:String

the name of the property

value:Object

the value of the property

warn:boolean

a flag indicating whether a warning should be issued

jdk.xml.internal back to summary

private Class JdkXmlUtils.DefaultSAXFactory

extends Object
Class Inheritance

The system-default factory

Field Summary

Modifier and TypeField and Description
private static final SAXParserFactory

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

instanceback to summary
private static final SAXParserFactory instance

Constructor Detail

DefaultSAXFactoryback to summary
private DefaultSAXFactory()