Class XmlConfigHelper


  • public class XmlConfigHelper
    extends java.lang.Object
    A simple XML utility class for reading configuration elements
    Since:
    4.0
    Author:
    Manik Surtani (manik@jboss.org)
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlConfigHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.Object,​java.lang.Object> setAttributes​(AttributeSet attributes, java.util.Map<?,​?> attribs, boolean isXmlAttribs, boolean failOnMissingAttribute)  
      static java.util.Map<java.lang.Object,​java.lang.Object> setValues​(java.lang.Object target, java.util.Map<?,​?> attribs, boolean isXmlAttribs, boolean failOnMissingSetter)  
      static void showUnrecognizedAttributes​(java.util.Map<java.lang.Object,​java.lang.Object> attribs)  
      static org.w3c.dom.Element stringToElement​(java.lang.String xml)
      Converts a String representing an XML snippet into an Element.
      static java.lang.String toString​(org.w3c.dom.Element e)  
      static java.lang.Object valueConverter​(java.lang.Class klass, java.lang.String value)  
      • Methods inherited from class java.lang.Object

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

      • XmlConfigHelper

        public XmlConfigHelper()
    • Method Detail

      • stringToElement

        public static org.w3c.dom.Element stringToElement​(java.lang.String xml)
                                                   throws java.lang.Exception
        Converts a String representing an XML snippet into an Element.
        Parameters:
        xml - snippet as a string
        Returns:
        a DOM Element
        Throws:
        java.lang.Exception - if unable to parse the String or if it doesn't contain valid XML.
      • valueConverter

        public static java.lang.Object valueConverter​(java.lang.Class klass,
                                                      java.lang.String value)
      • setAttributes

        public static java.util.Map<java.lang.Object,​java.lang.Object> setAttributes​(AttributeSet attributes,
                                                                                           java.util.Map<?,​?> attribs,
                                                                                           boolean isXmlAttribs,
                                                                                           boolean failOnMissingAttribute)
      • setValues

        public static java.util.Map<java.lang.Object,​java.lang.Object> setValues​(java.lang.Object target,
                                                                                       java.util.Map<?,​?> attribs,
                                                                                       boolean isXmlAttribs,
                                                                                       boolean failOnMissingSetter)
      • showUnrecognizedAttributes

        public static void showUnrecognizedAttributes​(java.util.Map<java.lang.Object,​java.lang.Object> attribs)
      • toString

        public static java.lang.String toString​(org.w3c.dom.Element e)