code: public final String validate(
          String in,
          String type
      ) {
      	    CShaniDomParser parser = new CShaniDomParser();
          Document doc =
              parser.parse(
                  new StringReader(in),
                  getTags(type),
                  getMerge(type)
              );
  
          if (doc != null)
              return doc.toString();
          else
              return in;
      }
docs: validate for xml the string in using the rules type 'type'
  
  @param in the string to validate
  @param type rule type
  
  @return the validated string