import java.io.File;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Notation;
public class Main {
public static void main(String[] argv) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setExpandEntityReferences(false);
Document doc = factory.newDocumentBuilder().parse(new File("filename"));
NamedNodeMap notations = doc.getDoctype().getNotations();
for (int i = 0; i < notations.getLength(); i++) {
Notation notation = (Notation) notations.item(i);
String notationName = notation.getNodeName();
String notationPublicId = notation.getPublicId();
String notationSystemId = notation.getSystemId();
}
}
}
|