title: Removing comments from xml file with vtd-xml , delete comment
body: <p>is there a way to remove the comments from a huge xml file (>200 MB), parsed by vtd-xml ?</p>
  
  <p>Both, comments before the root element</p>
  
  <pre><code>&lt;!-- comment --&gt;
  &lt;rootElement&gt;
  .
  .
  .
   &lt;/rootElement&gt;
  </code></pre>
  
  <p>and comments within</p>
  
  <pre><code>&lt;rootElement&gt;
  &lt;book&gt;
  &lt;!-- comment --&gt;
  &lt;/book&gt;
  &lt;/rootElement&gt;
  </code></pre>
  
  <p>The best solution would be with xPath. I tried</p>
  
  <pre><code>//comment()
  </code></pre>
  
  <p>which works with DOM but not with vtd-xml</p>
  
  <p>Here is my code for selecting comments</p>
  
  <pre><code>String xPath = "//comment()"
  XMLModifier xm = new XMLModifier();
  VTDGen vg = new VTDGen();
  if (vg.parseFile(fnIn,true)){
         VTDNav vn = vg.getNav();
         xm.bind(vn);
         nodeXpath(xPath,vn);
  }
  
  private void nodeXpath(String xPath, VTDNav vn) throws Exception{
      int result;
  
      AutoPilot ap = new AutoPilot();
      ap.selectXPath(xPath);
      ap.bind(vn);
      while((result = ap.evalXPath())!=-1){
          int p = vn.getText();
  
          if (p!=-1) {                
              System.out.println(vn.getText() + ", " + vn.toString(p));               
          }
      }
  }
  </code></pre>
  
  <p>But the nothing is printed to screen here.</p>
  
  <p>Is there a way to do that with vtd xml?</p>
  
  <p>Thanks for your help.</p>