Class XMLUtils


  • public final class XMLUtils
    extends java.lang.Object
    Static helpers for XML.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void appendAttributes​(IBuffer result, java.util.Properties attributes)
      Appends the attributes to result.
      static java.lang.String escape​(java.lang.String input)  
      static java.lang.String extractComment​(java.lang.String tag, java.util.Properties properties)  
      static java.lang.String xml​(java.lang.String indent, java.lang.String name, java.lang.String content, java.util.Properties attributes)
      Generate tag.
      static void xmlClose​(IBuffer result, java.lang.String indent, java.lang.String tag, java.lang.String comment)  
      static void xmlOpen​(IBuffer result, java.lang.String indent, java.lang.String tag, java.util.Properties attributes)  
      static void xmlOpen​(IBuffer result, java.lang.String indent, java.lang.String tag, java.util.Properties attributes, boolean noNewLine)  
      static void xmlOptional​(IBuffer result, java.lang.String sp, java.lang.String elementName, java.lang.Boolean value, java.util.Properties attributes)  
      static void xmlOptional​(IBuffer result, java.lang.String sp, java.lang.String elementName, java.lang.String value, java.util.Properties attributes)  
      static void xmlRequired​(IBuffer result, java.lang.String sp, java.lang.String elementName, java.lang.String value, java.util.Properties attributes)  
      • Methods inherited from class java.lang.Object

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

      • xml

        public static java.lang.String xml​(java.lang.String indent,
                                           java.lang.String name,
                                           @Nullable
                                           java.lang.String content,
                                           @Nullable
                                           java.util.Properties attributes)
        Generate tag. An opening and closing tag will be generated even if value is null.
        Parameters:
        indent - indent
        name - name of the tag
        content - content for this tag (or null)
        attributes - tag attributes (or null)
        Returns:
        The String value of the generated tag
      • extractComment

        public static java.lang.String extractComment​(java.lang.String tag,
                                                      java.util.Properties properties)
      • xmlOptional

        public static void xmlOptional​(IBuffer result,
                                       java.lang.String sp,
                                       java.lang.String elementName,
                                       java.lang.Boolean value,
                                       java.util.Properties attributes)
      • xmlOptional

        public static void xmlOptional​(IBuffer result,
                                       java.lang.String sp,
                                       java.lang.String elementName,
                                       @Nullable
                                       java.lang.String value,
                                       java.util.Properties attributes)
      • xmlRequired

        public static void xmlRequired​(IBuffer result,
                                       java.lang.String sp,
                                       java.lang.String elementName,
                                       @Nullable
                                       java.lang.String value,
                                       @Nullable
                                       java.util.Properties attributes)
      • xmlOpen

        public static void xmlOpen​(IBuffer result,
                                   java.lang.String indent,
                                   java.lang.String tag,
                                   java.util.Properties attributes)
      • appendAttributes

        public static void appendAttributes​(IBuffer result,
                                            java.util.Properties attributes)
        Appends the attributes to result. The attributes are added on a single line as: key1="value1" key2="value2" ... (a space is added before the first key)
        Parameters:
        result - the buffer to append attributes to.
        attributes - the attributes to append (may be null).
      • xmlOpen

        public static void xmlOpen​(IBuffer result,
                                   java.lang.String indent,
                                   java.lang.String tag,
                                   java.util.Properties attributes,
                                   boolean noNewLine)
      • xmlClose

        public static void xmlClose​(IBuffer result,
                                    java.lang.String indent,
                                    java.lang.String tag,
                                    java.lang.String comment)
      • escape

        public static java.lang.String escape​(java.lang.String input)