import java.io.StringReader; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Notation; import org.xml.sax.InputSource; public class Main { public static String getXMLData(){ return "your data"; } public static void main(String[] argv) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().parse(new InputSource(new StringReader(getXMLData()))); NamedNodeMap notations = doc.getDoctype().getNotations(); for (int i = 0; i < notations.getLength(); i++) { Notation notation = (Notation) notations.item(i); String notationName = notation.getNodeName(); System.out.println(notationName); String notationPublicId = notation.getPublicId(); String notationSystemId = notation.getSystemId(); } } }