Class Xml

java.lang.Object
com.google.api.client.xml.Xml

@Beta public class Xml extends Object
Beta
XML utilities.
Since:
1.0
Author:
Yaniv Inbar
  • Field Details

  • Method Details

    • createSerializer

      public static org.xmlpull.v1.XmlSerializer createSerializer()
      Returns a new XML serializer.
      Throws:
      IllegalArgumentException - if encountered an XmlPullParserException
    • createParser

      public static org.xmlpull.v1.XmlPullParser createParser() throws org.xmlpull.v1.XmlPullParserException
      Returns a new XML pull parser.
      Throws:
      org.xmlpull.v1.XmlPullParserException
    • toStringOf

      public static String toStringOf(Object element)
      Shows a debug string representation of an element data object of key/value pairs.

      It will make up something for the element name and XML namespaces. If those are known, it is better to use XmlNamespaceDictionary.toStringOf(String, Object).

      Parameters:
      element - element data object of key/value pairs (GenericXml, Map, or any object with public fields)
    • parseElement

      public static void parseElement(org.xmlpull.v1.XmlPullParser parser, Object destination, XmlNamespaceDictionary namespaceDictionary, Xml.CustomizeParser customizeParser) throws IOException, org.xmlpull.v1.XmlPullParserException
      Parses an XML element using the given XML pull parser into the given destination object.

      Requires the current event be XmlPullParser.START_TAG (skipping any initial XmlPullParser.START_DOCUMENT) of the element being parsed. At normal parsing completion, the current event will either be XmlPullParser.END_TAG of the element being parsed, or the XmlPullParser.START_TAG of the requested atom:entry.

      Parameters:
      parser - XML pull parser
      destination - optional destination object to parser into or null to ignore XML content
      namespaceDictionary - XML namespace dictionary to store unknown namespaces
      customizeParser - optional parser customizer or null for none
      Throws:
      IOException
      org.xmlpull.v1.XmlPullParserException