use of org.xmlpull.infoset.XmlDocument in project airavata by apache.
the class XMLUtil method loadXML.
/**
* @param file
* @return The XmlElement in the document.
* @throws IOException
*/
public static org.xmlpull.infoset.XmlElement loadXML(InputStream stream) throws IOException {
String xmlText = IOUtil.readToString(stream);
XmlDocument document = BUILDER.parseString(xmlText);
return document.getDocumentElement();
}
use of org.xmlpull.infoset.XmlDocument in project airavata by apache.
the class XMLUtil method stringToXmlElement.
/**
* Parses a specified string and returns the XmlElement (XPP5).
*
* @param string
* @return The XmlElement (XPP5) parsed.
*/
public static org.xmlpull.infoset.XmlElement stringToXmlElement(String string) {
XmlDocument document = BUILDER.parseString(string);
org.xmlpull.infoset.XmlElement element = document.getDocumentElement();
return element;
}
use of org.xmlpull.infoset.XmlDocument in project airavata by apache.
the class XMLUtil method saveXML.
/**
* Saves a specified XmlElement to a specified file.
*
* @param element
* @param file
* @throws IOException
*/
public static void saveXML(org.xmlpull.infoset.XmlElement element, File file) throws IOException {
XmlDocument document = BUILDER.newDocument();
document.setDocumentElement(element);
String xmlText = BUILDER.serializeToStringPretty(document);
IOUtil.writeToFile(xmlText, file);
}
Aggregations