org.apache.airavata.common.utils
Class XMLUtil

java.lang.Object
  extended by org.apache.airavata.common.utils.XMLUtil

public class XMLUtil
extends Object


Field Summary
static org.xmlpull.infoset.XmlInfosetBuilder BUILDER
          The XML builder for XPP5
static org.xmlpull.v1.builder.XmlInfosetBuilder BUILDER3
          The XML builder for XPP3.
 
Constructor Summary
XMLUtil()
           
 
Method Summary
static org.xmlpull.infoset.XmlNamespace declareNamespace(String prefixCandidate, String uri, boolean alwaysUseSuffix, org.xmlpull.infoset.XmlElement element)
           
static org.xmlpull.infoset.XmlNamespace declareNamespaceIfNecessary(String prefixCandidate, String uri, boolean alwaysUseSuffix, org.xmlpull.infoset.XmlElement element)
           
static org.xmlpull.infoset.XmlElement deepClone(org.xmlpull.infoset.XmlElement element)
           
static String getLocalPartOfQName(String qname)
          Returns the local part of a specified QName.
static String getPrefixOfQName(String qname)
          Returns the prefix of a specified QName.
static boolean isEqual(org.xmlpull.infoset.XmlElement elem1, org.xmlpull.infoset.XmlElement elem2)
           
static boolean isXML(String string)
           
static org.xmlpull.infoset.XmlElement loadXML(File file)
           
static void removeElements(org.xmlpull.infoset.XmlElement xml, String name)
           
static Document retrievalXMLDocForParse(String url)
           
static Document retrievalXMLDocFromUrl(String url)
           
static void saveXML(org.xmlpull.infoset.XmlElement element, File file)
          Saves a specified XmlElement to a specified file.
static void saveXML(org.xmlpull.v1.builder.XmlElement element, File file)
          Saves a specified XmlElement to a specified file.
static org.xmlpull.infoset.XmlElement stringToXmlElement(String string)
          Parses a specified string and returns the XmlElement (XPP5).
static org.xmlpull.v1.builder.XmlElement stringToXmlElement3(String string)
          Parses a specified string and returns the XmlElement (XPP3).
static void validate(org.apache.xmlbeans.XmlObject xmlObject)
          Validates a specified XmlObject along with logging errors if any.
static xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5(xsul.wsdl.WsdlDefinitions definitions3)
          Deprecated. 
static xsul.wsdl.WsdlDefinitions wsdlDefinitions5ToWsdlDefintions3(xsul5.wsdl.WsdlDefinitions definitions5)
          Deprecated. 
static org.xmlpull.infoset.XmlElement xmlElement3ToXmlElement5(org.xmlpull.v1.builder.XmlElement element)
          Converts a specified XmlElement (XPP3) to the XmlElement (XPP5).
static org.xmlpull.v1.builder.XmlElement xmlElement5ToXmlElement3(org.xmlpull.infoset.XmlElement element)
          Converts a specified XmlElement (XPP5) to the XmlElement (XPP3).
static String xmlElementToString(org.xmlpull.v1.builder.XmlElement element)
          Returns the XML string of a specified XmlElement.
static String xmlElementToString(org.xmlpull.infoset.XmlElement element)
          Returns the XML string as a specified XmlElement (XPP5).
static Element xppElementToDomElement(org.xmlpull.infoset.XmlElement xppElement, Document document)
          Converts a specified XPP5 XML element to a DOM element under a specified document.
static Element xppElementToDomElement(org.xmlpull.v1.builder.XmlElement xppElement, Document document)
          Converts a specified XPP3 XML element to a DOM element under a specified document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUILDER

public static final org.xmlpull.infoset.XmlInfosetBuilder BUILDER
The XML builder for XPP5


BUILDER3

public static final org.xmlpull.v1.builder.XmlInfosetBuilder BUILDER3
The XML builder for XPP3.

Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

stringToXmlElement3

public static org.xmlpull.v1.builder.XmlElement stringToXmlElement3(String string)
Parses a specified string and returns the XmlElement (XPP3).

Parameters:
string -
Returns:
The XmlElement (XPP3) parsed.

stringToXmlElement

public static org.xmlpull.infoset.XmlElement stringToXmlElement(String string)
Parses a specified string and returns the XmlElement (XPP5).

Parameters:
string -
Returns:
The XmlElement (XPP5) parsed.

xmlElement3ToXmlElement5

public static org.xmlpull.infoset.XmlElement xmlElement3ToXmlElement5(org.xmlpull.v1.builder.XmlElement element)
Converts a specified XmlElement (XPP3) to the XmlElement (XPP5).

Parameters:
element -
Returns:
The XmlElement (XPP5) converted.

xmlElement5ToXmlElement3

public static org.xmlpull.v1.builder.XmlElement xmlElement5ToXmlElement3(org.xmlpull.infoset.XmlElement element)
Converts a specified XmlElement (XPP5) to the XmlElement (XPP3).

Parameters:
element -
Returns:
The XmlElement (XPP3) converted.

xmlElementToString

public static String xmlElementToString(org.xmlpull.v1.builder.XmlElement element)
Returns the XML string of a specified XmlElement.

Parameters:
element - The specified XmlElement
Returns:
The XML string

xmlElementToString

public static String xmlElementToString(org.xmlpull.infoset.XmlElement element)
Returns the XML string as a specified XmlElement (XPP5).

Parameters:
element - The specified XmlElement
Returns:
The XML string

xppElementToDomElement

public static Element xppElementToDomElement(org.xmlpull.infoset.XmlElement xppElement,
                                             Document document)
Converts a specified XPP5 XML element to a DOM element under a specified document.

Parameters:
xppElement -
document -
Returns:
The converted DOM element.

wsdlDefinitions3ToWsdlDefintions5

@Deprecated
public static xsul5.wsdl.WsdlDefinitions wsdlDefinitions3ToWsdlDefintions5(xsul.wsdl.WsdlDefinitions definitions3)
Deprecated. 

Parameters:
definitions3 -
Returns:
The WsdlDefinitions (XSUL5)

wsdlDefinitions5ToWsdlDefintions3

@Deprecated
public static xsul.wsdl.WsdlDefinitions wsdlDefinitions5ToWsdlDefintions3(xsul5.wsdl.WsdlDefinitions definitions5)
Deprecated. 

Parameters:
definitions5 -
Returns:
The WsdlDefinitions (XSUL3)

xppElementToDomElement

public static Element xppElementToDomElement(org.xmlpull.v1.builder.XmlElement xppElement,
                                             Document document)
Converts a specified XPP3 XML element to a DOM element under a specified document.

Parameters:
xppElement -
document -
Returns:
The converted DOM element.

deepClone

public static org.xmlpull.infoset.XmlElement deepClone(org.xmlpull.infoset.XmlElement element)
                                                throws UtilsException
Parameters:
element -
Returns:
The cloned XmlElement.
Throws:
UtilsException

saveXML

public static void saveXML(org.xmlpull.infoset.XmlElement element,
                           File file)
                    throws IOException
Saves a specified XmlElement to a specified file.

Parameters:
element -
file -
Throws:
IOException

saveXML

public static void saveXML(org.xmlpull.v1.builder.XmlElement element,
                           File file)
                    throws IOException
Saves a specified XmlElement to a specified file.

Parameters:
element -
file -
Throws:
IOException

loadXML

public static org.xmlpull.infoset.XmlElement loadXML(File file)
                                              throws IOException
Parameters:
file -
Returns:
The XmlElement in the document.
Throws:
IOException

isXML

public static boolean isXML(String string)
Parameters:
string -
Returns:
true if the specified string is XML, false otherwise

validate

public static void validate(org.apache.xmlbeans.XmlObject xmlObject)
                     throws UtilsException
Validates a specified XmlObject along with logging errors if any.

Parameters:
xmlObject -
Throws:
UtilsException

getLocalPartOfQName

public static String getLocalPartOfQName(String qname)
Returns the local part of a specified QName.

Parameters:
qname - the specified QName in string, e.g. ns:value
Returns:
the local part of the QName, e.g. value

getPrefixOfQName

public static String getPrefixOfQName(String qname)
Returns the prefix of a specified QName.

Parameters:
qname - the specified QName in string, e.g. ns:value
Returns:
the prefix of the QName, e.g. ns

declareNamespaceIfNecessary

public static org.xmlpull.infoset.XmlNamespace declareNamespaceIfNecessary(String prefixCandidate,
                                                                           String uri,
                                                                           boolean alwaysUseSuffix,
                                                                           org.xmlpull.infoset.XmlElement element)
Parameters:
prefixCandidate -
uri -
alwaysUseSuffix -
element -
Returns:
The namespace found or declared.

declareNamespace

public static org.xmlpull.infoset.XmlNamespace declareNamespace(String prefixCandidate,
                                                                String uri,
                                                                boolean alwaysUseSuffix,
                                                                org.xmlpull.infoset.XmlElement element)
Parameters:
prefixCandidate -
uri -
alwaysUseSuffix -
element -
Returns:
The namespace declared.

removeElements

public static void removeElements(org.xmlpull.infoset.XmlElement xml,
                                  String name)
Parameters:
xml -
name -

retrievalXMLDocFromUrl

public static Document retrievalXMLDocFromUrl(String url)
Parameters:
url -
Returns:
Document

retrievalXMLDocForParse

public static Document retrievalXMLDocForParse(String url)
Parameters:
url -
Returns:
Document

isEqual

public static boolean isEqual(org.xmlpull.infoset.XmlElement elem1,
                              org.xmlpull.infoset.XmlElement elem2)
                       throws Exception
Throws:
Exception


Copyright © 2011-2012 The Apache Software Foundation. All Rights Reserved.