/** * @param metadata */ public void setMetadata(XmlElement metadata) { String metadataText; if (metadata == null) { metadataText = WSConstants.EMPTY_APPINFO; } else { metadataText = XMLUtil.xmlElementToString(metadata); } this.metadataTextArea.setText(metadataText); }
/** * 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); }
/** * Converts a specified XmlElement (XPP5) to the XmlElement (XPP3). * * @param element * @return The XmlElement (XPP3) converted. */ public static org.xmlpull.v1.builder.XmlElement xmlElement5ToXmlElement3(org.xmlpull.infoset.XmlElement element) { String string = xmlElementToString(element); return stringToXmlElement3(string); }
/** * Saves a specified XmlElement to a specified file. * * @param element * @param file * @throws IOException */ public static void saveXML(org.xmlpull.v1.builder.XmlElement element, File file) throws IOException { saveXML(xmlElement3ToXmlElement5(element), file); }
/** * @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; } }
OMElement next = omElementIterator.next(); String message = next.toStringWithConsume(); xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
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"); }
/** * @see org.apache.airavata.workflow.engine.invoker.Invoker#setInput(java.lang.String, java.lang.Object) */ public void setInput(String name, Object value) throws WorkflowException { try { if (value instanceof XmlElement) { // If the value is a complex type, change the name of the // element to the correct one. XmlElement valueElement = (XmlElement) value; valueElement.setName(name); } else if (value instanceof String) { if(XMLUtil.isXML((String)value)){ XmlElement valueElement = XMLUtil.stringToXmlElement3((String) value); valueElement.setName(name); value = valueElement; } // Simple case. } else { // convert int, doule to string. value = "" + value; } this.inputMessage.setObjectPart(name, value); } catch (RuntimeException e) { String message = "Error in setting an input. name: " + name + " value: " + value; throw new WorkflowException(message, e); } }
return compareObjs(child1, child2); } else { List<XmlElement> elemSet1 = getXmlElementsOnly(elem1.children().iterator()); List<XmlElement> elemSet2 = getXmlElementsOnly(elem2.children().iterator()); if(!isEqual(elemSet1.get(i), elemSet2.get(i))){ return false;
/** * @param file * @return The XmlElement in the document. * @throws IOException */ public static org.xmlpull.infoset.XmlElement loadXML(File file) throws IOException { return loadXML(new FileInputStream(file)); }
/** * * @param xml * @param name */ public static void removeElements(XmlElement xml, String name) { Iterable<XmlElement> removeElements = xml.elements(null, name); LinkedList<XmlElement> removeList = new LinkedList<XmlElement>(); for (XmlElement xmlElement : removeElements) { removeList.add(xmlElement); } for (XmlElement xmlElement : removeList) { xml.removeChild(xmlElement); } Iterable children = xml.children(); for (Object object : children) { if (object instanceof XmlElement) { XmlElement element = (XmlElement) object; removeElements(element, name); } } }
/** * @param prefixCandidate * @param uri * @param alwaysUseSuffix * @param element * @return The namespace found or declared. */ public static XmlNamespace declareNamespaceIfNecessary(String prefixCandidate, String uri, boolean alwaysUseSuffix, XmlElement element) { XmlNamespace namespace = element.lookupNamespaceByName(uri); if (namespace == null) { return declareNamespace(prefixCandidate, uri, alwaysUseSuffix, element); } else { return namespace; } }
/** * @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; } }
OMElement next = omElementIterator.next(); String message = next.toStringWithConsume(); xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
/** * @see org.apache.airavata.xbaya.invoker.Invoker#setInput(java.lang.String, java.lang.Object) */ public void setInput(String name, Object value) throws WorkflowException { try { if (value instanceof XmlElement) { // If the value is a complex type, change the name of the // element to the correct one. XmlElement valueElement = (XmlElement) value; valueElement.setName(name); } else if (value instanceof String) { if(XMLUtil.isXML((String)value)){ XmlElement valueElement = XMLUtil.stringToXmlElement3((String) value); valueElement.setName(name); value = valueElement; } // Simple case. } else { // convert int, doule to string. value = "" + value; } this.inputMessage.setObjectPart(name, value); } catch (RuntimeException e) { String message = "Error in setting an input. name: " + name + " value: " + value; throw new WorkflowException(message, e); } }
return compareObjs(child1, child2); } else { List<XmlElement> elemSet1 = getXmlElementsOnly(elem1.children().iterator()); List<XmlElement> elemSet2 = getXmlElementsOnly(elem2.children().iterator()); if(!isEqual(elemSet1.get(i), elemSet2.get(i))){ return false;
/** * Saves a specified XmlElement to a specified file. * * @param element * @param file * @throws IOException */ public static void saveXML(org.xmlpull.v1.builder.XmlElement element, File file) throws IOException { saveXML(xmlElement3ToXmlElement5(element), file); }
/** * Constructs a workflow from a given URI. * @param workflowFilePath The workflow URI path. * @throws GraphException If an error occurred while creating workflow. * @throws ComponentException If an error occurred while parsing the workflow content. */ public Workflow(URI workflowFilePath) throws GraphException, ComponentException { this(); try { XmlElement workflowElement = XMLUtil.loadXML(workflowFilePath.toURL().openStream()); parse(workflowElement); } catch (RuntimeException e) { throw new GraphException(e); } catch (IOException e) { throw new GraphException(e); } }
/** * * @param xml * @param name */ public static void removeElements(XmlElement xml, String name) { Iterable<XmlElement> removeElements = xml.elements(null, name); LinkedList<XmlElement> removeList = new LinkedList<XmlElement>(); for (XmlElement xmlElement : removeElements) { removeList.add(xmlElement); } for (XmlElement xmlElement : removeList) { xml.removeChild(xmlElement); } Iterable children = xml.children(); for (Object object : children) { if (object instanceof XmlElement) { XmlElement element = (XmlElement) object; removeElements(element, name); } } }