Class XmlUtils

java.lang.Object
com.android.utils.XmlUtils

public class XmlUtils
extends java.lang.Object
XML Utilities.

For Kotlin usage, many of these are exposed as more convenient extension methods in DomExtensions.

  • Constructor Summary

    Constructors 
    Constructor Description
    XmlUtils()  
  • Method Summary

    Modifier and Type Method Description
    static javax.xml.parsers.SAXParserFactory configureSaxFactory​(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean namespaceAware, boolean checkDtd)  
    static @NonNull javax.xml.parsers.SAXParser createSaxParser​(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean allowDocTypeDeclarations)  
    static java.lang.String formatFloatValue​(double value)
    Formats the number and removes trailing zeros after the decimal dot and also the dot itself if there were non-zero digits after it.
    static @NonNull java.lang.String stripBom​(@NonNull java.lang.String xml)
    Strips out a leading UTF byte order mark, if present

    Methods inherited from class java.lang.Object

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

  • Method Details

    • formatFloatValue

      public static java.lang.String formatFloatValue​(double value)
      Formats the number and removes trailing zeros after the decimal dot and also the dot itself if there were non-zero digits after it.
      Parameters:
      value - the value to be formatted
      Returns:
      the corresponding XML string for the value
    • stripBom

      public static @NonNull java.lang.String stripBom​(@NonNull java.lang.String xml)
      Strips out a leading UTF byte order mark, if present
    • configureSaxFactory

      public static javax.xml.parsers.SAXParserFactory configureSaxFactory​(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean namespaceAware, boolean checkDtd)
    • createSaxParser

      public static @NonNull javax.xml.parsers.SAXParser createSaxParser​(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean allowDocTypeDeclarations) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
      Throws:
      javax.xml.parsers.ParserConfigurationException
      org.xml.sax.SAXException