code: public static void main(String[] args) throws Exception{
          new ObjectInputSource<String>(null){
              @Override
              protected void write(String input, XMLDocument xml) throws SAXException{
                  String google = "http://google.com";
                  String yahoo = "http://yahoo.com";
  
                  xml.addProcessingInstruction("san", "test='1.2'");
  
                  xml.declarePrefix("google", google);
                  xml.declarePrefix("yahoo", yahoo);
                  xml.declarePrefix("http://msn.com");
  
                  xml.startElement(google, "hello");
                  xml.addAttribute("name", "value");
                  xml.addElement("xyz", "helloworld");
                  xml.addElement(google, "hai", "test");
                  xml.addXML(new InputSource("xml/xsds/note.xsd"), true);
                  xml.addComment("this is comment");
                  xml.addCDATA("this is sample cdata");
              }
          }.writeTo(new OutputStreamWriter(System.out, IOUtil.UTF_8), false, 4);
      }
docs: /*-------------------------------------------------[ Test ]---------------------------------------------------