Code example for Element

Methods: getAttribute, getTagName

0
	 * @param name the name 
	 * @return the required attribute 
	 * @throws Exception the exception 
	 */ 
	public static String getRequiredAttribute(String filename, Element element, String name) throws Exception {
		String value = element.getAttribute(name);
		if (value == null || value.length() == 0) {
			throwError(filename, "Missing required attribute '" + name + "' on element '" + element.getTagName() + "'");
		} 
		return value;
	} 
 
 
	/** 
	 * Throw error. 
	 * 
	 * @param filename the filename 
	 * @param cause the cause 
	 * @throws Exception the exception 
	 */ 
	public static void throwError(String filename, String cause) throws Exception {