Java tutorial
//package com.java2s; import org.xml.sax.Attributes; public class Main { public static final String getAttributeOrThrow(final Attributes pAttributes, final String pAttributeName) { final String value = pAttributes.getValue("", pAttributeName); if (value != null) { return value; } else { throw new IllegalArgumentException("No value found for attribute: '" + pAttributeName + "'"); } } }