import java.io.IOException;
import org.apache.xerces.parsers.DOMParser;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public class Main
{
public static void main(String args[])
{
try
{
// DOMParserを構築
DOMParser parser = new DOMParser();
// Well-formedであるかのXMLのチェック(DTDチェックは行わない)
parser.parse("test.xml");
}
catch(IOException io_ex)
{
io_ex.printStackTrace();
}
catch(SAXException sax_ex)
{
sax_ex.printStackTrace();
}
}
}
Source is here. (ZIP Format, 784Byte, Shift-JIS)