title: get data within a processing instruction tag in xml
body: <p>here's my code  :</p>
  
  <pre><code>void validate(String fileLocation){
      try{
          DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document document = builder.parse(new File(fileLocation));
          String[] pageContent=new String[100];
          for (int i = 0; i &lt; pageContent.length; i++) {
              String currentPageContent=  document.getElementsByTagName("?PG").item(i).getTextContent();
              System.out.println("the Current Page content is "+currentPageContent);
              pageContent[i]=currentPageContent;
          }
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>i have several tags as &lt; ?PG 1 ?> , &lt; ?PG 2 ?>,&lt; ?PG 3 ?> denoting page numbers how can i get  get the data from page tag.</p>