/** @see org.castor.xml.InternalContext#getXMLReader(java.lang.String) */ public XMLReader getXMLReader(final String features) { XMLReader reader = null; Boolean validation = _configuration.getBoolean(XMLConfiguration.PARSER_VALIDATION); Boolean namespaces = _configuration.getBoolean(XMLConfiguration.NAMESPACES); String readerClassName = _configuration.getString(XMLConfiguration.PARSER); if (readerClassName == null || readerClassName.length() == 0) { SAXParser saxParser = XMLParserUtils.getSAXParser(validation.booleanValue(), namespaces.booleanValue()); if (saxParser != null) { try { reader = saxParser.getXMLReader(); } catch (SAXException e) { LOG.error(Messages.format("conf.configurationError", e)); } } } if (reader == null) { if ((readerClassName == null) || (readerClassName.length() == 0) || (readerClassName.equalsIgnoreCase("xerces"))) { readerClassName = "org.apache.xerces.parsers.SAXParser"; } reader = XMLParserUtils.instantiateXMLReader(readerClassName); } XMLParserUtils.setFeaturesOnXmlReader( _configuration.getString(XMLConfiguration.PARSER_FEATURES, features), _configuration.getString(XMLConfiguration.PARSER_FEATURES_DISABLED, ""), validation.booleanValue(), namespaces.booleanValue(), reader); return reader; } // -- getXMLReader
/** * Returns the currently configured XMLSerializerFactory instance. * * @param serializerFactoryName the class name of the serializer factory * @return XMLSerializerFactory to use by Castor */ protected XMLSerializerFactory getSerializerFactory(final String serializerFactoryName) { return XMLParserUtils.getSerializerFactory(serializerFactoryName); }
/** @see org.castor.xml.InternalContext#getOutputFormat() */ public OutputFormat getOutputFormat() { return XMLParserUtils.getOutputFormat(_configuration); }
/** @see org.castor.xml.InternalContext#getSerializer() */ public Serializer getSerializer() { return XMLParserUtils.getSerializer(_configuration); }
/** @see org.castor.xml.InternalContext#getParser(java.lang.String) */ public Parser getParser(final String features) { return XMLParserUtils.getParser(_configuration, features); }
/** * {@inheritDoc} * * @see org.castor.xml.InternalContext#getSerializer() */ public Serializer getSerializer() { return XMLParserUtils.getSerializer(_properties); }
/** * {@inheritDoc} * * @see org.castor.xml.InternalContext#getParser(java.lang.String) */ public Parser getParser(final String features) { return XMLParserUtils.getParser(_properties, features); }