Java tutorial
//package com.java2s; /* * JLib - Publicitas Java library. * * Copyright (c) 2005, 2006, 2007, 2008 Publicitas SA. * Licensed under LGPL (LGPL-LICENSE.txt) license. */ import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /** * Returns the content of the specified attribute in the specified node. * @param node The node containing the desired attribute. * @param attributeName The name of the desired attribute. * @return The text of the specified attribute. If the attribute doesn't exist * in the specified node, the method returns an empty string. */ public static String GetNodeAttribute(Node node, String attributeName) { Element x = (Element) node; return x.getAttribute(attributeName); } }