public void parse(InputStream is, ContentHandler handler) throws JBossXBException { this.contentHandler = handler; trace = log.isTraceEnabled(); try { reader.parse(new InputSource(is)); } catch(Exception e) { throw new JBossXBException("Failed to parse source: " + e.getMessage(), e); } }
throw new JBossXBRuntimeException(e.getMessage(), e);
/** * Factory method for JavaWsdlMapping */ public JavaWsdlMapping parse(URL mappingURL) throws IOException { if (mappingURL == null) { throw NativeMessages.MESSAGES.illegalNullArgument("mappingURL"); } // setup the XML binding Unmarshaller InputStream is = new ResourceURL(mappingURL).openStream(); try { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); JavaWsdlMapping javaWsdlMapping = (JavaWsdlMapping)unmarshaller.unmarshal(is, this, null); return javaWsdlMapping; } catch (JBossXBException e) { IOException ioex = NativeMessages.MESSAGES.cannotParse(mappingURL); Throwable cause = e.getCause(); if (cause != null) ioex.initCause(cause); throw ioex; } finally { is.close(); } }
public static final XsdAnnotation unmarshal(String annotation) { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.mapFactoryToNamespace(JaxbObjectModelFactory.INSTANCE, Constants.NS_JAXB); unmarshaller.mapFactoryToNamespace(JbxbObjectModelFactory.INSTANCE, Constants.NS_JBXB); try { return (XsdAnnotation)unmarshaller.unmarshal(new StringReader(annotation), XsdObjectModelFactory.INSTANCE, (Object)null ); } catch(JBossXBException e) { throw new JBossXBRuntimeException("Failed to parse annotation string: " + annotation + ": " + e.getMessage(), e ); } }
/** * Unmarshal XML data from the specified InputStream and return the resulting content tree. */ public Object unmarshal(InputStream is) throws UnmarshalException { assertRequiredProperties(); org.jboss.xb.binding.Unmarshaller unm = UnmarshallerFactory.newInstance().newUnmarshaller(); SchemaBinding schemaBinding = JBossXBSupport.getOrCreateSchemaBinding(properties); try { return unm.unmarshal(is, schemaBinding); } catch (JBossXBException e) { throw new UnmarshalException(e.getMessage(), e); } }
public void parse(Reader reader, ContentHandler handler) throws JBossXBException { this.contentHandler = handler; trace = log.isTraceEnabled(); try { this.reader.parse(new InputSource(reader)); } catch(Exception e) { throw new JBossXBException("Failed to parse source: " + e.getMessage(), e); } }
public void parse(String systemId, ContentHandler handler) throws JBossXBException { this.contentHandler = handler; trace = log.isTraceEnabled(); try { reader.parse(systemId); } catch(Exception e) { throw new JBossXBException("Failed to parse source: " + getLocationAsString(systemId), e); } }
throw new JBossXBException("Failed to create a new SAX parser", e);