List of usage examples for javax.xml.stream XMLStreamException getNestedException
public Throwable getNestedException()
From source file:StaxCursorTest.java
public static void main(String[] args) throws Exception { String filename = "yourXML.xml"; XMLInputFactory xmlif = null; xmlif = XMLInputFactory.newInstance(); xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE); xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE); try {/*from w ww .jav a2 s.c o m*/ XMLStreamReader xmlr = xmlif.createXMLStreamReader(filename, new FileInputStream(filename)); int eventType = xmlr.getEventType(); printStartDocument(xmlr); while (xmlr.hasNext()) { eventType = xmlr.next(); printStartElement(xmlr); printEndElement(xmlr); printText(xmlr); printPIData(xmlr); printComment(xmlr); } } catch (XMLStreamException ex) { System.out.println(ex.getMessage()); if (ex.getNestedException() != null) { ex.getNestedException().printStackTrace(); } } }