public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public static void validate(final Node node, final String schemaFile) throws Exception { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = factory.newSchema(new URL(findResource(schemaFile).toURI().toASCIIString())); Validator validator = schema.newValidator(); // validate the DOM tree try { validator.validate(new DOMSource(node)); } catch (SAXException e) { ActiveMQClientLogger.LOGGER.errorOnXMLTransformInvalidConf(e); throw new IllegalStateException("Invalid configuration", e); } }
public Configuration parseMainConfig(final InputStream input) throws Exception { Reader reader = new InputStreamReader(input); String xml = XMLUtil.readerToString(reader); xml = XMLUtil.replaceSystemProps(xml); Element e = XMLUtil.stringToElement(xml); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(XMLUtil.findResource("schema/artemis-server.xsd")); Validator validator = schema.newValidator(); try { validator.validate(new DOMSource(e)); } catch (Exception ex) { ActiveMQServerLogger.LOGGER.error(ex.getMessage()); } Configuration config = new ConfigurationImpl(); parseMainConfig(e, config); return config; }