Java Code Examples for org.xml.sax.SAXException#getLocalizedMessage()
The following examples show how to use
org.xml.sax.SAXException#getLocalizedMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DOMConvertor.java From netbeans with Apache License 2.0 | 6 votes |
/** Read content from <code>r</code> and delegate to {@link #readElement} * passing parsed content as a root element of DOM document * @param r stream containing stored object * @return the read setting object * @exception IOException if the object cannot be read * @exception ClassNotFoundException if the object class cannot be resolved * @since 1.1 */ public final Object read(java.io.Reader r) throws java.io.IOException, ClassNotFoundException { Document doc = null; try { InputSource is = new InputSource(r); doc = XMLUtil.parse(is, false, false, null, org.openide.xml.EntityCatalog.getDefault()); setDocumentContext(doc, findContext(r)); return readElement(doc.getDocumentElement()); } catch (SAXException ex) { IOException ioe = new IOException(ex.getLocalizedMessage()); ioe.initCause(ex); throw ioe; } finally { if (doc != null) { clearCashesForDocument(doc); } } }
Example 2
Source File: DocumentReaderCallback.java From localization_nifi with Apache License 2.0 | 5 votes |
@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); } }
Example 3
Source File: TechnicalProductImportParser.java From development with Apache License 2.0 | 5 votes |
private String getText(SAXException e) { if (e instanceof SAXParseException) { return ((SAXParseException) e).getLineNumber() + ": " + e.getLocalizedMessage(); } else { return e.getMessage(); } }
Example 4
Source File: JAXBDataBinding.java From cxf with Apache License 2.0 | 5 votes |
public void validateSchema(Element ele, String uri, final OASISCatalogManager catalog, final SchemaCollection schemaCollection) throws ToolException { SchemaFactory schemaFact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFact.setResourceResolver(new LSResourceResolver() { public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { String s = JAXBDataBinding.mapSchemaLocation(systemId, baseURI, catalog); LOG.fine("validating: " + namespaceURI + " " + systemId + " " + baseURI + " " + s); if (s == null) { XmlSchema sc = schemaCollection.getSchemaByTargetNamespace(namespaceURI); if (sc != null) { StringWriter writer = new StringWriter(); sc.write(writer); InputSource src = new InputSource(new StringReader(writer.toString())); src.setSystemId(sc.getSourceURI()); return new LSInputSAXWrapper(src); } throw new ToolException("Schema not found for namespace: " + namespaceURI); } return new LSInputSAXWrapper(new InputSource(s)); } }); DOMSource domSrc = new DOMSource(ele, uri); try { schemaFact.newSchema(domSrc); } catch (SAXException e) { if (e.getLocalizedMessage().indexOf("src-resolve.4.2") > -1) { //Ignore schema resolve error and do nothing } else { //e.printStackTrace(); throw new ToolException("Schema Error : " + e.getLocalizedMessage(), e); } } }
Example 5
Source File: DocumentReaderCallback.java From nifi with Apache License 2.0 | 5 votes |
@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); } }