Android Utililty Methods XML Document Append

List of utility methods to do XML Document Append

Description

The list of methods to do XML Document Append are organized into topic(s).

Method

ElementappendTextNode(String tagName, String textContent, Document doc)
append Text Node
Element textNode = doc.createElement(tagName);
textNode.setTextContent(textContent);
return textNode;
NodebuildPlayerNode(Document doc, String user, String addy, double lat, double lng)
build Player Node
Element player = doc.createElement("player");
Node name = doc.createElement("name");
name.setTextContent(user);
Node id = doc.createElement("id");
id.setTextContent(addy);
Node loc = doc.createElement("location");
Node lati = doc.createElement("lat");
lati.setTextContent(String.valueOf(lat));
...
AttrcreateAttribute(Document document, String name, String value)
create Attribute
Attr attr = document.createAttribute(name);
attr.setValue(value);
return attr;
ElementcreateElementWithCDATASection(Document document, String name, String value)
create Element With CDATA Section
Element element = document.createElement(name);
element.appendChild(document.createCDATASection(value));
return element;
ElementcreateElementWithTextNode(Document document, String name, String value)
create Element With Text Node
Element element = document.createElement(name);
element.appendChild(document.createTextNode(value));
return element;
ElementcreateNode(Document d, String nameSpace, String name)
create Node
if (nameSpace == null || nameSpace.length() == 0)
    return d.createElement(name);
Element e = d.createElementNS(nameSpace, name);
NamedNodeMap map = d.getDocumentElement().getAttributes();
int i = 0;
int n = map.getLength();
for (i = 0; i < n; i++) {
    Attr attr = (Attr) map.item(i);
...
ElementcreateXmlElement(Document xml, Element parent, String name)
create Xml Element
Element e = xml.createElement(name);
try {
    parent.appendChild(e);
} catch (Exception ex) {
    System.out.println(ex.toString());
return e;