public class DefaultPrivateData extends Object implements PrivateData
This class provides a very simple representation of an XML sub-document. Each element is a key in a Map with its CDATA being the value. For example, given the following XML sub-document:
<foo xmlns="http://bar.com"> <color>blue</color> <food>pizza</food> </foo>In this case, getValue("color") would return "blue", and getValue("food") would return "pizza". This parsing mechanism mechanism is very simplistic and will not work as desired in all cases (for example, if some of the elements have attributes. In those cases, a custom
PrivateDataProvider
should be used.Constructor and Description |
---|
DefaultPrivateData(String elementName,
String namespace)
Creates a new generic private data object.
|
Modifier and Type | Method and Description |
---|---|
String |
getElementName()
Returns the XML element name of the private data sub-packet root element.
|
Set<String> |
getNames()
Returns a Set of the names that can be used to get
values of the private data.
|
String |
getNamespace()
Returns the XML namespace of the private data sub-packet root element.
|
String |
getValue(String name)
Returns a value given a name.
|
void |
setValue(String name,
String value)
Sets a value given the name.
|
String |
toXML()
Returns the XML reppresentation of the PrivateData.
|
public DefaultPrivateData(String elementName, String namespace)
elementName
- the name of the element of the XML sub-document.namespace
- the namespace of the element.public String getElementName()
getElementName
in interface PrivateData
public String getNamespace()
getNamespace
in interface PrivateData
public String toXML()
PrivateData
toXML
in interface PrivateData
public Set<String> getNames()
public String getValue(String name)
name
- the name.