/** {@inheritDoc} */ public String getLocalizedMessage() { if (this.localizedMessage != null) { return this.localizedMessage; } else { return super.getLocalizedMessage(); } }
import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.*; ... URL schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"); Source xmlFile = new StreamSource(new File("web.xml")); SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaFile); Validator validator = schema.newValidator(); try { validator.validate(xmlFile); System.out.println(xmlFile.getSystemId() + " is valid"); } catch (SAXException e) { System.out.println(xmlFile.getSystemId() + " is NOT valid"); System.out.println("Reason: " + e.getLocalizedMessage()); }
@Override public void process(final InputStream stream) throws IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(isNamespaceAware); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(stream); } catch (ParserConfigurationException pce) { throw new IOException(pce.getLocalizedMessage(), pce); } catch (SAXException saxe) { throw new IOException(saxe.getLocalizedMessage(), saxe); } }
/** {@inheritDoc} */ public String getLocalizedMessage() { if (this.localizedMessage != null) { return this.localizedMessage; } else { return super.getLocalizedMessage(); } }
/** {@inheritDoc} */ public String getLocalizedMessage() { if (this.localizedMessage != null) { return this.localizedMessage; } else { return super.getLocalizedMessage(); } }
@Override public void process(final InputStream stream) throws IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(isNamespaceAware); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(stream); } catch (ParserConfigurationException pce) { throw new IOException(pce.getLocalizedMessage(), pce); } catch (SAXException saxe) { throw new IOException(saxe.getLocalizedMessage(), saxe); } }
@Override public void read(JarPackageData jarPackage) throws CoreException { try { readXML(jarPackage); } catch (IOException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } catch (SAXException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } }
public void read(JarPackageData jarPackage) throws CoreException { try { readXML(jarPackage); } catch (IOException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } catch (SAXException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } }
@Override public void read(JarPackageData jarPackage) throws CoreException { try { readXML(jarPackage); } catch (IOException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } catch (SAXException ex) { String message= (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$ throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR, message, ex)); } }
public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) { try { this.resourceTransformer = resourceTransformer; SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) { try { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceValidator(Source xsd, ResourceTransformer resourceTransformer) { try { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public XSDResourceTypeIdentifier(Source xsd, ResourceTransformer resourceTransformer) { try { this.resourceTransformer = resourceTransformer; SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(xsd); this.validator = schema.newValidator(); } catch (SAXException ex) { LOG.severe(ex.getLocalizedMessage()); throw new SoapFault("Internal error", getSoapVersion().getReceiver()); } }
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { try { sendToHandler(logEntry); } catch (SAXException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, e.getLocalizedMessage()); SVNErrorManager.error(err, e); } }
/** * Handles a next log entry producing corresponding xml. * * @param logEntry log entry * @throws SVNException */ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { try { sendToHandler(logEntry); } catch (SAXException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } }
/** * Handles a next log entry producing corresponding xml. * * @param logEntry log entry * @throws SVNException */ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { try { sendToHandler(logEntry); } catch (SAXException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } }
/** * Handles a next log entry producing corresponding xml. * * @param logEntry log entry * @throws SVNException */ public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { try { sendToHandler(logEntry); } catch (SAXException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } }
public void handleStatus(SVNStatus status) throws SVNException { try { sendToHandler(status); } catch (SAXException th) { getDebugLog().error(th); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, th.getLocalizedMessage()); SVNErrorManager.error(err, th); } }
/** * Handles a next <code>status</code> object producing corresponding xml. * * @param status * @throws SVNException */ public void handleStatus(SVNStatus status) throws SVNException { try { sendToHandler(status); } catch (SAXException th) { getDebugLog().logSevere(SVNLogType.DEFAULT, th); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, th.getLocalizedMessage()); SVNErrorManager.error(err, th, SVNLogType.DEFAULT); } }
/** * Handles a next <code>status</code> object producing corresponding xml. * * @param status * @throws SVNException */ public void handleStatus(SVNStatus status) throws SVNException { try { sendToHandler(status); } catch (SAXException th) { getDebugLog().logSevere(SVNLogType.DEFAULT, th); SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, th.getLocalizedMessage()); SVNErrorManager.error(err, th, SVNLogType.DEFAULT); } }