/** * Creates a new instance that loads its content from the given <code>File</code>. * * @param file * source of the xml content * @throws XMLProcessingException */ public XMLAdapter( File file ) throws XMLProcessingException { if ( file != null ) { try { load( file.toURI().toURL() ); } catch ( MalformedURLException e ) { throw new XMLProcessingException( e ); } } }
@Override public String toString() { return this.getClass() + ": " + getMessage() + "\n" + stackTrace; }
/** * Initializes this <code>XMLAdapter</code> with the content from the given <code>URL</code>. Sets the SystemId, * too. * * @param url * source of the xml content * @throws XMLProcessingException */ public void load( URL url ) throws XMLProcessingException { if ( url == null ) { throw new IllegalArgumentException( "The given url may not be null" ); } try { load( get( STREAM, url.toExternalForm(), null ), url.toExternalForm() ); } catch ( IOException e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
/** * Same as #load(URL), but with http basic authentication * * @param url * @param httpBasicUser * @param httpBasicPass * @throws XMLProcessingException */ public void load( URL url, String httpBasicUser, String httpBasicPass ) throws XMLProcessingException { if ( url == null ) { throw new IllegalArgumentException( "The given url may not be null" ); } try { load( get( STREAM, url.toExternalForm(), null, httpBasicUser, httpBasicPass ), url.toExternalForm() ); } catch ( IOException e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
String msg = "Invalid 'xsi:schemaLocation' attribute: namespace " + token + "' is not a valid URI."; LOG.error( msg ); throw new XMLProcessingException( msg ); + "' is missing a schema URL."; LOG.error( msg ); throw new XMLProcessingException( msg ); } catch ( MalformedURLException ex ) { String msg = "Invalid 'xsi:schemaLocation' attribute: '" + token + "' for namespace '" + nsURI + "' could not be parsed as URL."; throw new XMLProcessingException( msg );
/** * Initializes this <code>XMLAdapter</code> with the content from the given <code>StringReader</code>. Sets the * SystemId, too. * * @param reader * source of the XML content * @param systemId * can not be null. This string should represent a URL that is related to the passed reader. If this URL * is not available or unknown, the string should contain the value of XMLFragment.DEFAULT_URL * * @throws XMLProcessingException */ public void load( StringReader reader, String systemId ) throws XMLProcessingException { try { if ( systemId == null ) { throw new NullPointerException( "'systemId' must not be null!" ); } setSystemId( systemId ); XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader( reader ); StAXOMBuilder builder = new StAXOMBuilder( parser ); rootElement = builder.getDocumentElement(); } catch ( XMLStreamException e ) { throw new XMLProcessingException( e.getMessage(), e ); } catch ( OMException e ) { throw new XMLProcessingException( e.getMessage(), e ); } catch ( FactoryConfigurationError e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
public Object evaluateXPath( XPath xpath, Object context ) throws XMLProcessingException { Object result; try { result = getAXIOMXPath( xpath ).evaluate( context ); } catch ( JaxenException e ) { throw new XMLProcessingException( e.getMessage() ); } return result; }
rootElement = builder.getDocumentElement(); } catch ( XMLStreamException e ) { throw new XMLProcessingException( e.getMessage(), e );
/** * @return the parsed ServiceConfiguration * @throws XMLProcessingException */ public static ServiceConfiguration parse( Workspace workspace, ResourceMetadata<OWS> metadata ) throws XMLProcessingException { try { DeegreeWCS wcsConf = (DeegreeWCS) unmarshall( "org.deegree.services.jaxb.wcs", ( (OWSProvider) metadata.getProvider() ).getSchema(), metadata.getLocation().getAsStream(), workspace ); return wcsConf.getServiceConfiguration(); } catch ( JAXBException e ) { throw new XMLProcessingException( e.getMessage(), e ); } }
throw new XMLProcessingException( errorHandler.getErrors().get( 0 ) );
XSModel model = schemaLoader.loadInputList( inputList ); if ( !errorHandler.getErrors().isEmpty() ) { throw new XMLProcessingException( errorHandler.getErrors().get( 0 ) );