code: public static void main(String[] args) throws Exception{
          String google = "http://google.com";
          String yahoo = "http://yahoo.com";
  
          XMLDocument xml = new XMLDocument(new StreamResult(System.out), false, 4, null);
  
          xml.startDocument();{
              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");
              }
          }
          xml.endDocument();
      }
docs: /*-------------------------------------------------[ Testing ]---------------------------------------------------