public class XMLParserUtils extends Object
Constructor and Description |
---|
XMLParserUtils() |
Modifier and Type | Method and Description |
---|---|
static OutputFormat |
getOutputFormat(AbstractProperties properties) |
static Parser |
getParser(AbstractProperties properties,
String features) |
static SAXParser |
getSAXParser(boolean validation,
boolean namespaces)
To get a SAXParser instance which is then used to get either
parser or XMLReader.
|
static SAXParser |
getSAXParser(SAXParserFactory saxParserFactory)
To get a SAXParser instance from a given
SAXParserFactory , which is then used to obtain either
Parser or XMLReader . |
static SAXParserFactory |
getSAXParserFactory(boolean validation,
boolean namespaces)
To get a SAXParserFactory instance which is then used to obtain an
SAXParser instance. |
static Serializer |
getSerializer(AbstractProperties properties) |
static XMLSerializerFactory |
getSerializerFactory(String serializerFactoryName)
Returns the currently configured XMLSerializerFactory instance.
|
static Parser |
instantiateParser(String className)
Instantiates an
Parser instance directly, using Class.forName(String)
to obtain the Class instance, and uses Class.newInstance()
to create the actual instance. |
static XMLReader |
instantiateXMLReader(String className)
Instantiates an
XMLReader instance directly, using Class.forName(String)
to obtain the Class instance, and uses Class.newInstance()
to create the actual instance. |
static void |
setFeaturesOnXmlReader(String parserFeatures,
String parserFeaturesToDisable,
boolean validation,
boolean namespaces,
XMLReader xmlReader)
Sets features on XML reader instance.
|
public static void setFeaturesOnXmlReader(String parserFeatures, String parserFeaturesToDisable, boolean validation, boolean namespaces, XMLReader xmlReader)
properties
- the Properties to read parser features fromdefaultFeatures
- any default features to usevalidation
- Whether to enable validation or not.namespaces
- Whether to enable namespace support for not.xmlReader
- The XMLReader instance to configure.public static SAXParser getSAXParser(boolean validation, boolean namespaces)
validation
- validation flag to set into parser factorynamespaces
- namespace flag to set into parser factorypublic static SAXParser getSAXParser(SAXParserFactory saxParserFactory)
SAXParserFactory
, which is then used to obtain either
Parser
or XMLReader
.SAXParser
for further usepublic static SAXParserFactory getSAXParserFactory(boolean validation, boolean namespaces)
SAXParser
instance.namespaces
- Whether to provide namespace support.validation
- Whether to produce a validating SAX parser.public static XMLReader instantiateXMLReader(String className)
XMLReader
instance directly, using Class.forName(String)
to obtain the Class
instance, and uses Class.newInstance()
to create the actual instance.public static Parser instantiateParser(String className)
Parser
instance directly, using Class.forName(String)
to obtain the Class
instance, and uses Class.newInstance()
to create the actual instance.public static Parser getParser(AbstractProperties properties, String features)
public static Serializer getSerializer(AbstractProperties properties)
InternalContext.getSerializer()
public static OutputFormat getOutputFormat(AbstractProperties properties)
InternalContext.getOutputFormat()
public static XMLSerializerFactory getSerializerFactory(String serializerFactoryName)
serializerFactoryName
- the class name of the serializer factoryCopyright © 2015. All rights reserved.