code: public static DTDSubset flattenExternalSubset(WstxInputSource src, Writer flattenWriter,
                                                    boolean inclComments, boolean inclConditionals,
                                                    boolean inclPEs)
          throws IOException, XMLStreamException
      {
          ReaderConfig cfg = ReaderConfig.createFullDefaults();
          // Need to create a non-shared copy to populate symbol table field
          cfg = cfg.createNonShared(new SymbolTable());
  
          /* Let's assume xml 1.0... can be taken as an arg later on, if we
           * truly care.
           */
          FullDTDReader r = new FullDTDReader(src, cfg, null, true, XmlConsts.XML_V_UNKNOWN);
          r.setFlattenWriter(flattenWriter, inclComments, inclConditionals,
                             inclPEs);
          DTDSubset ss = r.parseDTD();
          r.flushFlattenWriter();
          flattenWriter.flush();
          return ss;
      }
docs: Method that will parse, process and output contents of an external
  DTD subset. It will do processing similar to
  {@link #readExternalSubset}, but additionally will copy its processed
  ("flattened") input to specified writer.
  
  @param src Input source used to read the main external subset
  @param flattenWriter Writer to output processed DTD content to
  @param inclComments If true, will pass comments to the writer; if false,
  will strip comments out
  @param inclConditionals If true, will include conditional block markers,
  as well as intervening content; if false, will strip out both markers
  and ignorable sections.
  @param inclPEs If true, will output parameter entity declarations; if
  false will parse and use them, but not output.