Code example for Attr

Methods: setValue

0
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		DocumentBuilder db = dbf.newDocumentBuilder();
		Document xml = db.newDocument();
		Node root = xml.createElement(rootName);
		Attr a = xml.createAttribute("version");
		a.setValue("1.0");
		root.getAttributes().setNamedItem(a);
		xml.appendChild(root);
		return xml;
	} 
 
	public final static String getXml(Node node)
	{ 
		// http://groups.google.com/group/android-developers/browse_thread/thread/2cc84c1bc8a6b477/5edb01c0721081b0 
		StringBuilder buffer = new StringBuilder();
 
		if (node == null) { return ""; }
 
		if (node instanceof Document)
		{ 
			buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");