public class XmlHttpContent extends AbstractXmlHttpContentBeta
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.
Constructors
XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)
public XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)XML namespace dictionary.
| Parameters | |
|---|---|
| Name | Description |
namespaceDictionary |
XmlNamespaceDictionaryXML namespace dictionary |
elementName |
StringXML element local name, optionally prefixed by its namespace alias, for
example |
data |
ObjectKey/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 |
|
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 |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|