org.eclipse.higgins.sts.utilities
Class XMLHelper

java.lang.Object
  extended byorg.eclipse.higgins.sts.utilities.XMLHelper

public class XMLHelper
extends Object

Used to help with common XML processing functions

Author:
mikemci at us dot ibm dot com

Constructor Summary
XMLHelper()
           
 
Method Summary
static Element domFromFile(String strFileName)
           
static Element domFromStream(InputStream inputStream)
           
static String escapedString(String strUnescaped)
           
static String getTextContent(Element element)
           
static String getTextContent(Text text)
           
static String htmlEncode(String pText)
           
static void logElement(Element domElement)
           
static void maskPasswordForChildren(Element element)
          Mask password out of trace
static org.apache.axiom.om.OMElement omFromFile(String strFileName)
           
static org.apache.axiom.om.OMElement omFromStream(InputStream inputStream)
           
static void printHex(byte[] b)
           
static void printHex(byte[] b, int len)
           
static void printHex(int[] b)
           
static void printHex(int[] b, int len)
           
static void printHex(short[] b)
           
static void printHex(short[] b, int len)
           
static void printHex(String label, byte[] b)
           
static void printHex(String label, byte[] b, int len)
           
static void printHex(String label, int[] b)
           
static void printHex(String label, int[] b, int len)
           
static void printHex(String label, short[] b)
           
static void printHex(String label, short[] b, int len)
           
static Element reparseElement(Element domElement)
           
static void setTextContent(Element element, String value)
           
static void setTextContent(Text text, String value)
           
static String StripNamespaceDeclaration(String strElement)
           
static void stripNewLinesFromElement(Element domElement)
           
static String stripNewLinesFromString(String strValue)
           
static void stripWhiteSpaceFromElement(Element domElement)
           
static String stripWhiteSpaceFromString(String strValue)
           
static byte[] toByteArr(String no)
           
static Element toDOM(org.apache.axiom.om.OMElement omElement)
          Converts an OMElement to an equivalent DOM Element
static Element toDOM(String strElement)
           
static org.eclipse.higgins.sts.api.IElement toElement(Element domElement)
          Converts an DOM Element to an equivalent Element
static org.eclipse.higgins.sts.api.IElement toElement(org.apache.axiom.om.OMElement omElement)
          Converts an OMElement to an equivalent Element
static String toHex(byte b)
           
static String toHex(byte[] b)
           
static String toHex(byte[] b, int len)
           
static String toHex(int i)
           
static String toHex(int[] b)
           
static String toHex(int[] b, int len)
           
static String toHex(short i)
           
static String toHex(short[] b)
           
static String toHex(short[] b, int len)
           
static String toHexF(byte[] b)
           
static String toHexF(byte[] b, int len)
           
static String toHexF(int[] b)
           
static String toHexF(int[] b, int len)
           
static String toHexF(short[] b)
           
static String toHexF(short[] b, int len)
           
static String toHexF(String label, byte[] b)
           
static String toHexF(String label, byte[] b, int len)
           
static String toHexF(String label, int[] b)
           
static String toHexF(String label, int[] b, int len)
           
static String toHexF(String label, short[] b)
           
static String toHexF(String label, short[] b, int len)
           
static org.apache.axiom.om.OMElement toOM(Element domElement)
          Converts an DOM Element into an equivalent OMElement
static org.apache.axiom.om.OMElement toOM(String strElement)
           
static String toString(Element domElement)
           
static String toString(org.apache.axiom.om.OMElement omElement)
          Converts an OMElement to an equivalent String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

maskPasswordForChildren

public static void maskPasswordForChildren(Element element)
Mask password out of trace


htmlEncode

public static String htmlEncode(String pText)

escapedString

public static String escapedString(String strUnescaped)

toByteArr

public static byte[] toByteArr(String no)

printHex

public static void printHex(byte[] b)

printHex

public static void printHex(short[] b)

printHex

public static void printHex(int[] b)

printHex

public static void printHex(String label,
                            byte[] b)

printHex

public static void printHex(String label,
                            short[] b)

printHex

public static void printHex(String label,
                            int[] b)

toHexF

public static String toHexF(String label,
                            byte[] b)

toHexF

public static String toHexF(String label,
                            short[] b)

toHexF

public static String toHexF(String label,
                            int[] b)

toHexF

public static String toHexF(int[] b)

toHexF

public static String toHexF(short[] b)

toHexF

public static String toHexF(byte[] b)

toHex

public static String toHex(byte[] b)

toHex

public static String toHex(short[] b)

toHex

public static String toHex(int[] b)

printHex

public static void printHex(String label,
                            byte[] b,
                            int len)

printHex

public static void printHex(String label,
                            short[] b,
                            int len)

printHex

public static void printHex(String label,
                            int[] b,
                            int len)

printHex

public static void printHex(byte[] b,
                            int len)

printHex

public static void printHex(short[] b,
                            int len)

printHex

public static void printHex(int[] b,
                            int len)

toHexF

public static String toHexF(String label,
                            int[] b,
                            int len)

toHexF

public static String toHexF(String label,
                            short[] b,
                            int len)

toHexF

public static String toHexF(String label,
                            byte[] b,
                            int len)

toHexF

public static String toHexF(byte[] b,
                            int len)

toHexF

public static String toHexF(short[] b,
                            int len)

toHexF

public static String toHexF(int[] b,
                            int len)

toHex

public static String toHex(int[] b,
                           int len)

toHex

public static String toHex(short[] b,
                           int len)

toHex

public static String toHex(byte[] b,
                           int len)

toHex

public static String toHex(byte b)

toHex

public static String toHex(short i)

toHex

public static String toHex(int i)

stripNewLinesFromString

public static String stripNewLinesFromString(String strValue)

stripWhiteSpaceFromString

public static String stripWhiteSpaceFromString(String strValue)

toElement

public static org.eclipse.higgins.sts.api.IElement toElement(org.apache.axiom.om.OMElement omElement)
                                                      throws Exception
Converts an OMElement to an equivalent Element

Parameters:
omElement - an OMElement to be converted into a Element
Returns:
the converted Element
Throws:
Exception

toElement

public static org.eclipse.higgins.sts.api.IElement toElement(Element domElement)
                                                      throws Exception
Converts an DOM Element to an equivalent Element

Parameters:
domElement - a DOM Element to be converted into a Element
Returns:
the converted Element
Throws:
Exception

toDOM

public static Element toDOM(org.apache.axiom.om.OMElement omElement)
                     throws Exception
Converts an OMElement to an equivalent DOM Element

Parameters:
omElement - an OMElement to be converted into a DOM Element
Returns:
the converted DOM Element
Throws:
Exception

toString

public static String toString(org.apache.axiom.om.OMElement omElement)
                       throws Exception
Converts an OMElement to an equivalent String

Parameters:
omElement - an OMElement to be converted into a String
Returns:
the converted a String
Throws:
Exception

StripNamespaceDeclaration

public static String StripNamespaceDeclaration(String strElement)

toOM

public static org.apache.axiom.om.OMElement toOM(Element domElement)
                                          throws Exception
Converts an DOM Element into an equivalent OMElement

Parameters:
domElement - an Element to be converted
Returns:
the converted DOM Element
Throws:
Exception

getTextContent

public static String getTextContent(Text text)

setTextContent

public static void setTextContent(Text text,
                                  String value)

getTextContent

public static String getTextContent(Element element)

setTextContent

public static void setTextContent(Element element,
                                  String value)

stripNewLinesFromElement

public static void stripNewLinesFromElement(Element domElement)

stripWhiteSpaceFromElement

public static void stripWhiteSpaceFromElement(Element domElement)

toString

public static String toString(Element domElement)
                       throws IOException
Throws:
IOException

logElement

public static void logElement(Element domElement)
                       throws IOException
Throws:
IOException

toDOM

public static Element toDOM(String strElement)
                     throws IOException,
                            Exception
Throws:
IOException
Exception

reparseElement

public static Element reparseElement(Element domElement)
                              throws IOException,
                                     Exception
Throws:
IOException
Exception

domFromStream

public static Element domFromStream(InputStream inputStream)
                             throws FileNotFoundException,
                                    Exception
Throws:
FileNotFoundException
Exception

domFromFile

public static Element domFromFile(String strFileName)
                           throws FileNotFoundException,
                                  Exception
Throws:
FileNotFoundException
Exception

omFromStream

public static org.apache.axiom.om.OMElement omFromStream(InputStream inputStream)
                                                  throws FileNotFoundException,
                                                         Exception
Throws:
FileNotFoundException
Exception

omFromFile

public static org.apache.axiom.om.OMElement omFromFile(String strFileName)
                                                throws FileNotFoundException,
                                                       Exception
Throws:
FileNotFoundException
Exception

toOM

public static org.apache.axiom.om.OMElement toOM(String strElement)
                                          throws Exception
Throws:
Exception