Class XmlIndenter

java.lang.Object
edu.internet2.middleware.grouperClient.util.XmlIndenter

public class XmlIndenter extends Object
indent xml, assumes the input is not yet indented. Also, this is only for testing or logging or documentation purposes, not production
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    closeTag(String xml, int startTagIndex)
    find if the tag is a close tag (e.g.
    static int
    findNextEndTagIndex(String xml, int startFrom)
    find the end tag from xml and a start from index
    static int
    findNextStartTagIndex(String xml, int startFrom)
    find the start tag from xml and a start from index
    static boolean
    ignoreTag(String theXml, int theStartTagIndex, int theEndTagIndex)
    see if we can ignore the tag, e.g.
    get the result
    static boolean
    selfClosedTag(String xml, int endTagIndex)
    find if the tag is closed on
    static String
    tagName(String xml, int startTagIndex, int endTagIndex)
    find the current tag name should support: < a /> or < / b>
    static boolean
    textTag(String xml, int endTagIndex, String tagName, String nextTagName, boolean isNextCloseTag)
    find if the tag contains text (note, dont call this if know it is self closed, though in that case it shouldnt be text anyways)

    Methods inherited from class java.lang.Object

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

    • XmlIndenter

      public XmlIndenter(String theXml)
      Parameters:
      theXml - is the xml to format indenter
  • Method Details

    • result

      public String result()
      get the result
      Returns:
      the result
    • ignoreTag

      public static boolean ignoreTag(String theXml, int theStartTagIndex, int theEndTagIndex)
      see if we can ignore the tag, e.g. xml header or doctype
      Parameters:
      theXml -
      theStartTagIndex -
      theEndTagIndex -
      Returns:
      true if ignore
    • tagName

      public static String tagName(String xml, int startTagIndex, int endTagIndex)
      find the current tag name should support: < a /> or < / b>
      Parameters:
      xml -
      startTagIndex -
      endTagIndex - (or -1 if none found)
      Returns:
      the current tag name
    • findNextStartTagIndex

      public static int findNextStartTagIndex(String xml, int startFrom)
      find the start tag from xml and a start from index
      Parameters:
      xml -
      startFrom -
      Returns:
      the start tag index of -1 if not found another
    • findNextEndTagIndex

      public static int findNextEndTagIndex(String xml, int startFrom)
      find the end tag from xml and a start from index
      Parameters:
      xml -
      startFrom -
      Returns:
      the start tag index of -1 if not found another
    • selfClosedTag

      public static boolean selfClosedTag(String xml, int endTagIndex)
      find if the tag is closed on
      Parameters:
      xml -
      endTagIndex -
      Returns:
      true if self closed
    • closeTag

      public static boolean closeTag(String xml, int startTagIndex)
      find if the tag is a close tag (e.g. </a>)
      Parameters:
      xml -
      startTagIndex -
      Returns:
      true if self closed
    • textTag

      public static boolean textTag(String xml, int endTagIndex, String tagName, String nextTagName, boolean isNextCloseTag)
      find if the tag contains text (note, dont call this if know it is self closed, though in that case it shouldnt be text anyways)
      Parameters:
      xml -
      endTagIndex -
      tagName -
      nextTagName -
      isNextCloseTag -
      Returns:
      true if contains text (as opposed to other tags)