Package org.exolab.castor.xml.util
Class XMLParserUtils
- java.lang.Object
-
- org.exolab.castor.xml.util.XMLParserUtils
-
public class XMLParserUtils extends java.lang.ObjectA couple of routines to manipulate XMLParser instances. Mostly extracted from 'old' LocalConfiguration class.- Since:
- 1.1.3
- Version:
- $Id$
- Author:
- Joachim Grueneis, jgrueneis_at_gmail_dot_com
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static org.apache.commons.logging.LogLOGLogger to be used.
-
Constructor Summary
Constructors Constructor Description XMLParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OutputFormatgetOutputFormat(AbstractProperties properties)static org.xml.sax.ParsergetParser(AbstractProperties properties, java.lang.String features)static javax.xml.parsers.SAXParsergetSAXParser(boolean validation, boolean namespaces)To get a SAXParser instance which is then used to get either parser or XMLReader.static SerializergetSerializer(AbstractProperties properties)static XMLSerializerFactorygetSerializerFactory(java.lang.String serializerFactoryName)Returns the currently configured XMLSerializerFactory instance.static org.xml.sax.ParserinstantiateParser(java.lang.String className)Instantiates anParserinstance directly, usingClass.forName(String)to obtain theClassinstance, and usesClass.newInstance()to create the actual instance.static org.xml.sax.XMLReaderinstantiateXMLReader(java.lang.String className)Instantiates anXMLReaderinstance directly, usingClass.forName(String)to obtain theClassinstance, and usesClass.newInstance()to create the actual instance.static voidsetFeaturesOnXmlReader(java.lang.String parserFeatures, java.lang.String parserFeaturesToDisable, boolean validation, boolean namespaces, org.xml.sax.XMLReader xmlReader)Sets features on XML reader instance.
-
-
-
Method Detail
-
setFeaturesOnXmlReader
public static void setFeaturesOnXmlReader(java.lang.String parserFeatures, java.lang.String parserFeaturesToDisable, boolean validation, boolean namespaces, org.xml.sax.XMLReader xmlReader)Sets features on XML reader instance.- Parameters:
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.
-
getSAXParser
public static javax.xml.parsers.SAXParser getSAXParser(boolean validation, boolean namespaces)To get a SAXParser instance which is then used to get either parser or XMLReader.- Parameters:
validation- validation flag to set into parser factorynamespaces- namespace flag to set into parser factory- Returns:
- the SAXParser for further use
-
instantiateXMLReader
public static org.xml.sax.XMLReader instantiateXMLReader(java.lang.String className)
Instantiates anXMLReaderinstance directly, usingClass.forName(String)to obtain theClassinstance, and usesClass.newInstance()to create the actual instance.- Parameters:
className- The class name of theXMLReaderinstance to be instantiated.- Returns:
- An
XMLReaderinstance.
-
instantiateParser
public static org.xml.sax.Parser instantiateParser(java.lang.String className)
Instantiates anParserinstance directly, usingClass.forName(String)to obtain theClassinstance, and usesClass.newInstance()to create the actual instance.- Parameters:
className- The class name of theParserinstance to be instantiated.- Returns:
- An
Parserinstance.
-
getParser
public static org.xml.sax.Parser getParser(AbstractProperties properties, java.lang.String features)
-
getSerializer
public static Serializer getSerializer(AbstractProperties properties)
- See Also:
InternalContext.getSerializer()
-
getOutputFormat
public static OutputFormat getOutputFormat(AbstractProperties properties)
- See Also:
InternalContext.getOutputFormat()
-
getSerializerFactory
public static XMLSerializerFactory getSerializerFactory(java.lang.String serializerFactoryName)
Returns the currently configured XMLSerializerFactory instance.- Parameters:
serializerFactoryName- the class name of the serializer factory- Returns:
- XMLSerializerFactory to use by Castor
-
-