Java tutorial
//package com.java2s; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.events.XMLEvent; public class Main { public static void printPIData(XMLStreamReader xmlr) { if (xmlr.getEventType() == XMLEvent.PROCESSING_INSTRUCTION) { System.out.print("<?" + xmlr.getPITarget() + " " + xmlr.getPIData() + "?>"); } } }