/** * @param string * @return true if the specified string is XML, false otherwise */ public static boolean isXML(String string) { try { stringToXmlElement(string); return true; } catch (RuntimeException e) { return false; } }
/** * @param string * @return true if the specified string is XML, false otherwise */ public static boolean isXML(String string) { try { stringToXmlElement(string); return true; } catch (RuntimeException e) { return false; } }
/** * Converts a specified XmlElement (XPP3) to the XmlElement (XPP5). * * @param element * @return The XmlElement (XPP5) converted. */ public static org.xmlpull.infoset.XmlElement xmlElement3ToXmlElement5(org.xmlpull.v1.builder.XmlElement element) { String string = xmlElementToString(element); return stringToXmlElement(string); }
public org.xmlpull.infoset.XmlElement toXml(){ try { JAXBContext context = JAXBContext.newInstance(WSComponentApplication.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); // pretty marshaller.setProperty(Marshaller.JAXB_ENCODING, "ISO-8859-1"); // specify encoding // output xml to outputstream. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); marshaller.marshal(this, byteArrayOutputStream); return XMLUtil.stringToXmlElement(byteArrayOutputStream.toString()); } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Converts a specified XmlElement (XPP3) to the XmlElement (XPP5). * * @param element * @return The XmlElement (XPP5) converted. */ public static org.xmlpull.infoset.XmlElement xmlElement3ToXmlElement5(org.xmlpull.v1.builder.XmlElement element) { String string = xmlElementToString(element); return stringToXmlElement(string); }
/** * * @param message */ public void handleNotification(String message) { try { XmlElement event = XMLUtil.stringToXmlElement(message); this.monitor.handleNotification(event); } catch (Exception e) { // Just log them because they can be unrelated messages sent to // this topic by accident. logger.warn("Could not parse received notification: " + message, e); } }
/** * @param wsdlString * @return The WSDL * @throws UtilsException */ public static WsdlDefinitions stringToWSDL(String wsdlString) throws UtilsException { try { XmlElement wsdlElement = XMLUtil.stringToXmlElement(wsdlString); WsdlDefinitions definitions = new WsdlDefinitions(wsdlElement); return definitions; } catch (RuntimeException e) { throw new UtilsException(e); } }
org.xmlpull.infoset.XmlElement s = XMLUtil.stringToXmlElement(byteArrayOutputStream.toString()); System.out.println(s.toString()); } catch (JAXBException e) {
} else { try { inputMetadata = XMLUtil.stringToXmlElement(inputMetadataText); } catch (RuntimeException e) { String warning = "The input metadata is ill-formed."; } else { try { outputMetadata = XMLUtil.stringToXmlElement(outputMetadataText); } catch (RuntimeException e) { String warning = "The output metadata is ill-formed.";
public void process(WsdlDefinitions wsdl) { XmlElement types = wsdl.getTypes(); Iterable<XmlElement> schemas = types.elements(null, "schema"); LinkedList<XmlElement> removeList = new LinkedList<XmlElement>(); for (XmlElement schema : schemas) { String tns = schema.attributeValue("targetNamespace"); if (null != tns && -1 != tns.indexOf("http://www.extreme.indiana.edu/xbaya")) { } else { removeList.add(schema); } } for (XmlElement schema : removeList) { types.removeChild(schema); } types.addChild(XMLUtil.stringToXmlElement(GFacSimpleTypesXSD.XSD)); types.addChild(XMLUtil.stringToXmlElement(LeadCrosscutXSD.XSD)); types.addChild(XMLUtil.stringToXmlElement(LeadContextHeaderXSD.XSD)); XmlElement xml = wsdl.xml(); XMLUtil.removeElements(xml, "partnerLinkType"); XMLUtil.removeElements(xml, "default"); }
listOfValues.removeAll(listOfValues); String output = (String) systemInvoker.getOutput(node1.getOutputPort(0).getName()); XmlElement xmlElement = XMLUtil.stringToXmlElement("<result>" + output + "</result>"); Iterator iterator1 = xmlElement.children().iterator(); while (iterator1.hasNext()) {
XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS); GpelConstants.GPEL_NS = gpelNS; this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString)); } catch (RuntimeException e) { String error = "Failed to parse the BPEL document."; try { String wsdlText = workflowWSDLElement.requiredText(); this.workflowWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlText)); } catch (RuntimeException e) { String error = "Failed to parse the workflow WSDL.";
this.tridentWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlString)); new TridentTransformer().process(this.tridentWSDL);
private void setInput() { String name = this.nameTextField.getText(); String description = this.descriptionTextArea.getText(); String metadataText = this.metadataTextArea.getText(); if (name.length() == 0) { String warning = "The name cannot be empty."; this.xbayaGUI.getErrorWindow().error(warning); return; } XmlElement metadata; if (metadataText.length() == 0) { metadata = null; } else { try { metadata = XMLUtil.stringToXmlElement(metadataText); } catch (RuntimeException e) { String warning = "The metadata is ill-formed."; this.xbayaGUI.getErrorWindow().error(warning, e); return; } } this.node.setConfigured(true); this.node.setConfiguredName(name); this.node.setDescription(description); this.node.setMetadata(metadata); hide(); this.xbayaGUI.getGraphCanvas().repaint(); }
private void ok() { List<RegistrySearchResult> selectedValues = this.list.getSelectedValues(); try { for (RegistrySearchResult result : selectedValues) { org.apache.airavata.model.Workflow workflow = getClient().getWorkflow(result.getResourceName()); XmlElement workflowElement = XMLUtil.stringToXmlElement(workflow.getGraph()); Workflow w = new Workflow(workflowElement); GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true); newGraphCanvas.setWorkflow(w); engine.getGUI().getGraphCanvas().setWorkflowFile(null); } hide(); } catch (Exception e) { e.printStackTrace(); engine.getGUI().getErrorWindow().error(e); } }
} else { try { value = XMLUtil.stringToXmlElement(valueString); } catch (RuntimeException e) { String warning = "The XML for the default value is not valid."; } else { try { metadata = XMLUtil.stringToXmlElement(metadataText); } catch (RuntimeException e) { String warning = "The metadata is ill-formed.";
} else { try { value = XMLUtil.stringToXmlElement(valueString); } catch (RuntimeException e) { String warning = "The XML for the default value is not valid.";
} else { try { value = XMLUtil.stringToXmlElement(valueString); } catch (RuntimeException e) { String warning = "The XML for the default value is not valid.";