Java tutorial
//package com.java2s; import java.io.IOException; import org.w3c.dom.Element; public class Main { private static void validateTagName(Element n, String expected) throws IOException { if (!n.getTagName().equalsIgnoreCase(expected)) { throw new IOException("Expected tag name '" + expected + "' but was '" + n.getTagName() + "'."); } } }