Code example for NamedNodeMap

Methods: getNamedItem

0
			if(rootElement.getNodeType() == Node.ELEMENT_NODE) {
				String eName = rootElement.getNodeName();
				if(eName.equals("taskAssignment")) {
					NamedNodeMap nm = rootElement.getAttributes();
					if(nm != null) {
						Node nId = nm.getNamedItem("id");
						if(nId == null) {
							throw new InvalidParameterException("Error: id must be specified");
						} 
						String sId = nId.getNodeValue();
										 
						// Insert the data into the database 
						Class.forName("org.postgresql.Driver");	
						connection = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/de","ws", "ws1234");
						Statement statement = connection.createStatement();
						String sql1 = "UPDATE de_TaskAssignments SET status = \'";
						String sql3 = "\' WHERE ta_id=";
						String sql4 = ";";
					 
						// Update status if supplied 
						Node aNode;
						aNode = nm.getNamedItem("status");
						if(aNode != null) {
							String value = aNode.getNodeValue();							
							String sqlUpdate = sql1 + value + sql3 + sId + sql4;
							statement.execute(sqlUpdate);
						} else {