Package com.android.utils
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.SAXParserFactoryconfigureSaxFactory(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean namespaceAware, boolean checkDtd)static @NonNull javax.xml.parsers.SAXParsercreateSaxParser(@NonNull javax.xml.parsers.SAXParserFactory factory, boolean allowDocTypeDeclarations)static java.lang.StringformatFloatValue(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.StringstripBom(@NonNull java.lang.String xml)Strips out a leading UTF byte order mark, if present
-
Constructor Details
-
XmlUtils
public XmlUtils()
-
-
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.ParserConfigurationExceptionorg.xml.sax.SAXException
-