Class XmlHttpContent (1.43.0)

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
NameDescription
namespaceDictionaryXmlNamespaceDictionary

XML namespace dictionary

elementNameString

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

dataObject

Key/value pair data

Methods

getData()

public final Object getData()

Returns the key/value pair data.

Returns
TypeDescription
Object

getElementName()

public final String getElementName()

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

Returns
TypeDescription
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
NameDescription
mediaTypeHttpMediaType
Returns
TypeDescription
XmlHttpContent
Overrides

writeTo(XmlSerializer serializer)

public final void writeTo(XmlSerializer serializer)

Writes the content to the given XML serializer.

Parameter
NameDescription
serializerorg.xmlpull.v1.XmlSerializer
Overrides Exceptions
TypeDescription
IOException