Android examples for XML:XML Element
add Double Property to XML Element
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static final String PROPERTY_NODE = "property"; public static final String NAME_ATTR = "name"; public static final String DOUBLE_ATTR = "doublevalue"; public static void addDoubleProperty(Document document, Element parent, String name, double value) { addPropertyNode(document, parent, name).setAttribute(DOUBLE_ATTR, Double.toString(value)); }//from w ww .ja v a 2s.co m private static Element addPropertyNode(Document document, Element parent, String name) { Element element = document.createElement(PROPERTY_NODE); parent.appendChild(element); element.setAttribute(NAME_ATTR, name); return element; } }