I need to retrieve all items in the SimpleDB domain from java application. So, I used the select method, but I don't know is there an easy way to store the retrieved values in an xml file?? or I've to create the attributes and elements by myself and set values to them, like this:
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("Items");
doc.appendChild(rootElement);
SelectRequest selectRequest = new SelectRequest(selectExpression);
for (Item item : sdb.select(selectRequest).getItems()) {
// <item>-------------------
itemBeg = doc.createElement("Item");
rootElement.appendChild(itemBeg);
// <Name>-------------------
Elmname = doc.createAttribute("Name");
Elmname.setValue(item.getName());
itemBeg.setAttributeNode(Elmname);
// <Attributes> -----------------
attrib = doc.createElement("Attributes");
itemBeg.appendChild(attrib);
for (Attribute attribute : item.getAttributes()) {
// attribute <Name> -----------------
attrName = doc.createAttribute("Name");
attrName.setValue(attribute.getName());
attrib.setAttributeNode(attrName);
// attribute <Value> -------------------
attrValue = doc.createAttribute("Value");
attrValue.setValue(attribute.getValue());
attrib.setAttributeNode(attrValue);
}