org.eclipse.higgins.sts.utilities
Class XMLHelper

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

public class XMLHelper
extends java.lang.Object

Used to help with common XML processing functions

Author:
mikemci at us dot ibm dot com

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

Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

maskPasswordForChildren

public static void maskPasswordForChildren(org.w3c.dom.Element element)
Mask password out of trace


htmlEncode

public static java.lang.String htmlEncode(java.lang.String pText)

escapedString

public static java.lang.String escapedString(java.lang.String strUnescaped)

toByteArr

public static byte[] toByteArr(java.lang.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(java.lang.String label,
                            byte[] b)

printHex

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

printHex

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

toHexF

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

toHexF

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

toHexF

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

toHexF

public static java.lang.String toHexF(int[] b)

toHexF

public static java.lang.String toHexF(short[] b)

toHexF

public static java.lang.String toHexF(byte[] b)

toHex

public static java.lang.String toHex(byte[] b)

toHex

public static java.lang.String toHex(short[] b)

toHex

public static java.lang.String toHex(int[] b)

printHex

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

printHex

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

printHex

public static void printHex(java.lang.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 java.lang.String toHexF(java.lang.String label,
                                      int[] b,
                                      int len)

toHexF

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

toHexF

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

toHexF

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

toHexF

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

toHexF

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

toHex

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

toHex

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

toHex

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

toHex

public static java.lang.String toHex(byte b)

toHex

public static java.lang.String toHex(short i)

toHex

public static java.lang.String toHex(int i)

stripNewLinesFromString

public static java.lang.String stripNewLinesFromString(java.lang.String strValue)

stripWhiteSpaceFromString

public static java.lang.String stripWhiteSpaceFromString(java.lang.String strValue)

toElement

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

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

toElement

public static org.eclipse.higgins.sts.api.IElement toElement(org.w3c.dom.Element domElement)
                                                      throws java.lang.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:
java.lang.Exception

toDOM

public static org.w3c.dom.Element toDOM(org.apache.axiom.om.OMElement omElement)
                                 throws java.lang.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:
java.lang.Exception

toString

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

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

StripNamespaceDeclaration

public static java.lang.String StripNamespaceDeclaration(java.lang.String strElement)

toOM

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

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

getTextContent

public static java.lang.String getTextContent(org.w3c.dom.Text text)

setTextContent

public static void setTextContent(org.w3c.dom.Text text,
                                  java.lang.String value)

getTextContent

public static java.lang.String getTextContent(org.w3c.dom.Element element)

setTextContent

public static void setTextContent(org.w3c.dom.Element element,
                                  java.lang.String value)

stripNewLinesFromElement

public static void stripNewLinesFromElement(org.w3c.dom.Element domElement)

stripWhiteSpaceFromElement

public static void stripWhiteSpaceFromElement(org.w3c.dom.Element domElement)

toString

public static java.lang.String toString(org.w3c.dom.Element domElement)
                                 throws java.io.IOException
Throws:
java.io.IOException

logElement

public static void logElement(org.w3c.dom.Element domElement)
                       throws java.io.IOException
Throws:
java.io.IOException

toDOM

public static org.w3c.dom.Element toDOM(java.lang.String strElement)
                                 throws java.io.IOException,
                                        java.lang.Exception
Throws:
java.io.IOException
java.lang.Exception

reparseElement

public static org.w3c.dom.Element reparseElement(org.w3c.dom.Element domElement)
                                          throws java.io.IOException,
                                                 java.lang.Exception
Throws:
java.io.IOException
java.lang.Exception

domFromStream

public static org.w3c.dom.Element domFromStream(java.io.InputStream inputStream)
                                         throws java.io.FileNotFoundException,
                                                java.lang.Exception
Throws:
java.io.FileNotFoundException
java.lang.Exception

domFromFile

public static org.w3c.dom.Element domFromFile(java.lang.String strFileName)
                                       throws java.io.FileNotFoundException,
                                              java.lang.Exception
Throws:
java.io.FileNotFoundException
java.lang.Exception

omFromStream

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

omFromFile

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

toOM

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