option.setLoadTrimTextBuffer(); ProcessDescriptionsDocument processDescriptionDocument = ProcessDescriptionsDocument.Factory.parse(xmlDesc, option);
validate(); document = ProcessDescriptionsDocument.Factory.newInstance(); document.addNewProcessDescriptions(); XmlCursor c = document.newCursor();
private ProcessDescriptionType loadProcessDescription(File describeProcessFile){ try { InputStream xmlDesc = new FileInputStream(describeProcessFile); XmlOptions option = new XmlOptions(); option.setLoadTrimTextBuffer(); ProcessDescriptionsDocument doc = ProcessDescriptionsDocument.Factory.parse(xmlDesc, option); if(doc.getProcessDescriptions().getProcessDescriptionArray().length == 0) { LOGGER.warn("ProcessDescription is empty! " + describeProcessFile.getName()); return null; } return doc.getProcessDescriptions().getProcessDescriptionArray(0); } catch(IOException e) { LOGGER.warn("Could not initialize algorithm, parsing error! " + describeProcessFile.getName(), e); } catch(XmlException e) { LOGGER.warn("Could not initialize algorithm, parsing error! " + describeProcessFile.getName(), e); } return null; }
private ProcessDescriptionsDocument retrieveDescriptionViaGET(String[] processIDs, String url) throws WPSClientException{ ClientDescribeProcessRequest req = new ClientDescribeProcessRequest(); req.setIdentifier(processIDs); String requestURL = req.getRequest(url); try { URL urlObj = new URL(requestURL); InputStream is = urlObj.openStream(); Document doc = checkInputStream(is); return ProcessDescriptionsDocument.Factory.parse(doc, options); } catch (MalformedURLException e) { throw new WPSClientException("URL seems not to be valid", e); } catch (IOException e) { throw new WPSClientException("Error occured while receiving data", e); } catch(XmlException e) { throw new WPSClientException("Error occured while parsing ProcessDescription document", e); } }
private static ProcessDescriptionType createProcessDescription (File describeProcessFile){ try { InputStream xmlDesc = new FileInputStream(describeProcessFile); XmlOptions option = new XmlOptions(); option.setLoadTrimTextBuffer(); ProcessDescriptionsDocument doc = ProcessDescriptionsDocument.Factory.parse(xmlDesc, option); if(doc.getProcessDescriptions().getProcessDescriptionArray().length == 0) { LOGGER.warn("ProcessDescription is empty!"); return null; } return doc.getProcessDescriptions().getProcessDescriptionArray(0); } catch(IOException e) { LOGGER.warn("Could not initialize algorithm, parsing error! ", e); } catch(XmlException e) { LOGGER.warn("Could not initialize algorithm, parsing error! ", e); } return null; }