Class XmlHttpContent (1.45.2)

public class XmlHttpContent extends AbstractXmlHttpContent

Beta
Serializes XML HTTP content based on the data key/value mapping object for an item.

Sample usage:

static void setContent(HttpRequest request, XmlNamespaceDictionary namespaceDictionary, String elementName, Object data) { request.setContent(new XmlHttpContent(namespaceDictionary, elementName, data)); }

Implementation is not thread-safe.

Inheritance

Object > AbstractHttpContent > AbstractXmlHttpContent > XmlHttpContent

Constructors

XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)

public XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)

XML namespace dictionary.

Parameters
Name Description
namespaceDictionary XmlNamespaceDictionary

XML namespace dictionary

elementName String

XML element local name, optionally prefixed by its namespace alias, for example "atom:entry"

data Object

Key/value pair data

Methods

getData()

public final Object getData()

Returns the key/value pair data.

Returns
Type Description
Object

getElementName()

public final String getElementName()

Returns the XML element local name, optionally prefixed by its namespace alias, for example "atom:entry".

Returns
Type Description
String

setMediaType(HttpMediaType mediaType)

public XmlHttpContent setMediaType(HttpMediaType mediaType)

Sets the media type to use for the Content-Type header, or null if unspecified.

This will also overwrite any previously set parameter of the media type (for example "charset"), and therefore might change other properties as well.

Parameter
Name Description
mediaType HttpMediaType
Returns
Type Description
XmlHttpContent
Overrides

writeTo(XmlSerializer serializer)

public final void writeTo(XmlSerializer serializer)

Writes the content to the given XML serializer.

Parameter
Name Description
serializer org.xmlpull.v1.XmlSerializer
Overrides
Exceptions
Type Description
IOException