public void convertToXml(OutputStream os,String charset) throws IOException {
  out=new OutputStreamWriter(os,Charset.forName(charset));
  if (rootTag != null) {
    out.write("<" + rootTag + ">"+ System.lineSeparator());
  }
  PdfStructTreeRoot structTreeRoot=document.getStructTreeRoot();
  if (structTreeRoot == null)   throw new PdfException(PdfException.DocumentDoesntContainStructTreeRoot);
  inspectKids(structTreeRoot.getKids());
  if (rootTag != null) {
    out.write("</" + rootTag + ">");
  }
  out.flush();
  out.close();
}

public void convertToXml ( OutputStream os , String charset ) throws IOException { out = new OutputStreamWriter ( os , Charset . forName ( charset ) ) ; if ( rootTag != null ) { out . write ( "<" + rootTag + ">" + System . lineSeparator ( ) ) ; } PdfStructTreeRoot structTreeRoot = document . getStructTreeRoot ( ) ; if ( structTreeRoot == null ) throw new PdfException ( PdfException . DocumentDoesntContainStructTreeRoot ) ; inspectKids ( structTreeRoot . getKids ( ) ) ; if ( rootTag != null ) { out . write ( "</" + rootTag + ">" ) ; } out . flush ( ) ; out . close ( ) ; }
converts the current tag structure into an xml file with provided encoding .
