Class Xml
java.lang.Object
com.google.api.client.xml.Xml
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCustomizes the behavior of XML parsing. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String"application/xml; charset=utf-8"media type used as a default for XML parsing. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.xmlpull.v1.XmlPullParserReturns a new XML pull parser.static org.xmlpull.v1.XmlSerializerReturns a new XML serializer.static voidparseElement(org.xmlpull.v1.XmlPullParser parser, Object destination, XmlNamespaceDictionary namespaceDictionary, Xml.CustomizeParser customizeParser) Parses an XML element using the given XML pull parser into the given destination object.static StringtoStringOf(Object element) Shows a debug string representation of an element data object of key/value pairs.
-
Field Details
-
MEDIA_TYPE
"application/xml; charset=utf-8"media type used as a default for XML parsing.Use
HttpMediaType.equalsIgnoreParameters(HttpMediaType)for comparing media types.- Since:
- 1.10
-
-
Method Details
-
createSerializer
public static org.xmlpull.v1.XmlSerializer createSerializer()Returns a new XML serializer.- Throws:
IllegalArgumentException- if encountered anXmlPullParserException
-
createParser
public static org.xmlpull.v1.XmlPullParser createParser() throws org.xmlpull.v1.XmlPullParserExceptionReturns a new XML pull parser.- Throws:
org.xmlpull.v1.XmlPullParserException
-
toStringOf
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 initialXmlPullParser.START_DOCUMENT) of the element being parsed. At normal parsing completion, the current event will either beXmlPullParser.END_TAGof the element being parsed, or theXmlPullParser.START_TAGof the requestedatom:entry.- Parameters:
parser- XML pull parserdestination- optional destination object to parser into ornullto ignore XML contentnamespaceDictionary- XML namespace dictionary to store unknown namespacescustomizeParser- optional parser customizer ornullfor none- Throws:
IOExceptionorg.xmlpull.v1.XmlPullParserException
-