Class XmlUtils


  • public class XmlUtils
    extends java.lang.Object
    Helper class for xml transformation
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String applyTransformationResource​(java.lang.String xml, java.lang.String transformationResource)
      Removes all ignored nodes from the given xml
      static java.lang.String evaluateXPath​(java.lang.String targetXml, java.lang.String xPath)  
      protected static java.lang.String transform​(java.lang.String targetXml, javax.xml.transform.stream.StreamSource source)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • applyTransformationResource

        public static java.lang.String applyTransformationResource​(java.lang.String xml,
                                                                   java.lang.String transformationResource)
        Removes all ignored nodes from the given xml
        Parameters:
        xml - the xml to process
        transformationResource - the transformation to apply (classpath resource)
        Returns:
        the processed xml (in case of errors the original xml is returned)
      • evaluateXPath

        public static final java.lang.String evaluateXPath​(java.lang.String targetXml,
                                                           java.lang.String xPath)
        Parameters:
        targetXml - the XML to apply the XPath expression to
        xPath - the XPath expression to apply
        Returns:
        the result of XPath evaluation
      • transform

        protected static java.lang.String transform​(java.lang.String targetXml,
                                                    javax.xml.transform.stream.StreamSource source)
                                             throws javax.xml.transform.TransformerFactoryConfigurationError
        Throws:
        javax.xml.transform.TransformerFactoryConfigurationError