public XmlGenerator(StreamProperties props,Writer w,Charset cs,boolean prettyPrint,XmlNamespace defaultNamespace){
  EnumSet<WriterFlags> flags=EnumSet.of(WriterFlags.WRITE_HEADER);
  if (prettyPrint) {
    flags.add(WriterFlags.PRETTY_PRINT);
  }
  try {
    this.xw=new XmlWriter(w,flags,cs.name());
  }
 catch (  IOException ioe) {
    throw new RuntimeException("Unable to create XML generator",ioe);
  }
  this.rootMetadata=props.getRootMetadata();
  this.defaultNamespace=defaultNamespace;
}

public XmlGenerator ( StreamProperties props , Writer w , Charset cs , boolean prettyPrint , XmlNamespace defaultNamespace ) { EnumSet < WriterFlags > flags = EnumSet . of ( WriterFlags . WRITE_HEADER ) ; if ( prettyPrint ) { flags . add ( WriterFlags . PRETTY_PRINT ) ; } try { this . xw = new XmlWriter ( w , flags , cs . name ( ) ) ; } catch ( IOException ioe ) { throw new RuntimeException ( "Unable to create XML generator" , ioe ) ; } this . rootMetadata = props . getRootMetadata ( ) ; this . defaultNamespace = defaultNamespace ; }
creates a new xml generator for generating xml output , using the given namespace as the default namespace .
