Package com.dtrules.xmlparser

Examples of com.dtrules.xmlparser.XMLPrinter


    * Set the output streams for debug and trace.
    */
   public void setOutput(OutputStream debugtrace, OutputStream error){
       if(debugtrace != null){
           outPs = new PrintStream(debugtrace);
           out   = new XMLPrinter(outPs);
       }
       err   = new PrintStream(error);
   }
View Full Code Here


   /**
    * Set the output streams for debug and trace.
    */
   public void setOutput(PrintStream debugtrace, PrintStream error){
       outPs = debugtrace;
       out   = new XMLPrinter(outPs);
       err = error;
   }
View Full Code Here

                  entityfile = new FileOutputStream(getOutputDirectory(rs)+number+root+"_entities_before.xml");
                  RArray entitystack = RArray.newArray(session,false,false);
                  for(int i=0; i< session.getState().edepth()-2; i++){
                      entitystack.add(session.getState().entityfetch(i));
                  }
                  session.printEntityReport(new XMLPrinter(entityfile), false, false, session.getState(), "entitystack", entitystack);
              }
             
              // Once the data is loaded, execute the rules.
              RulesException ex = null;
              try{
                  executeDecisionTables(session);
              }catch(RulesException e){
                  ex = e;
              }
             
              // Then if asked, dump the entities.
              if(Verbose()){
                  entityfile = new FileOutputStream(getOutputDirectory(rs)+number+root+"_entities_after.xml");
                  RArray entitystack = RArray.newArray(session,false,false);
                  for(int i=0; i< session.getState().edepth()-2; i++){
                      entitystack.add(session.getState().entityfetch(i));
                  }
                  session.printEntityReport(new XMLPrinter(entityfile),false, false, session.getState(), "entitystack", entitystack);
               }
             
              if(ex!=null)throw ex;
             
              // Print the report
View Full Code Here

            throws Exception {
        RArray entitystack = RArray.newArray(session,false,false);
        for(int i=0; i< session.getState().edepth()-2; i++){
            entitystack.add(session.getState().entityfetch(i));
        }
        session.printEntityReport(new XMLPrinter(out),true, false, session.getState(), "entitystack", entitystack);
    }
View Full Code Here

        removeIds(child);
      }
    }
    
    public void compareTestResults(RuleSet rs) throws Exception {
        XMLPrinter report = new XMLPrinter(compareTestResultsReport(rs));
       
        ostream.println();
       
        report.opentag("results");
        File outputs = new File(getOutputDirectory(rs));
        if(outputs == null || !outputs.isDirectory()){
            ostream.println("'"+getOutputDirectory(rs)+"' does not exist or is not a directory");
        }
        boolean changes = false;
        boolean missingResults = false;
        File files[] = outputs.listFiles();
        for(File file : files){
            if(file.getName().endsWith("_results.xml")){
                Node result1=null, result2=null;
                try{
                    result1 = XMLTree.BuildTree(new FileInputStream(file),false,false);
                    result2 = XMLTree.BuildTree(new FileInputStream(getResultDirectory(rs)+file.getName()),false, false);
                    if(result1 != null && result2 != null){
                        removeIds(result1);
                        removeIds(result2);
                        String msg = compareNodes(result1,result2);
                        if(msg == null){
                            report.printdata("match","file",file.getName(),"");
                        }else{
                          changes = true;
                          ostream.flush();
                          estream.println(file.getName()+"--> "+msg);
                          estream.flush();
                          report.printdata("resultChanged","file",file.getName(),msg);
                        }
                    }else{
                      ostream.flush();
                      estream.println(file.getName()+" has no result file; No compare done.");
                      estream.flush();
                        report.printdata("error","file",file.getName(),"");
                    }
                }catch (Exception e){
                  missingResults = true;
                    report.printdata("unknown","file",file.getName(),"Missing Files to do the compare");
                }
            }
        }
        report.closetag();
       
        if(changes){
          estream.println("\nSome results have changed.  Check the TestResults.xml for all results.");
        }else{
          ostream.println("\nALL PASS: No changes found when compared to results files.");
View Full Code Here

    /**
     * Prints the current state of the AutoDataMap as a single configuration file.
     * @param fstream
     */
    public void printDataLoadXML(OutputStream fstream) {
        XMLPrinter xout = new XMLPrinter("dataload",fstream);
       
        for(IMapNode mno : dataMap){
            mno.printDataLoadXML(this, xout);
        }
       
        xout.close();
    }
View Full Code Here

     * @param noSpaces
     * @return
     */
    public String xmlPull(boolean noSpaces){
        StringWriter sw = new StringWriter();
        XMLPrinter xout = new XMLPrinter(sw);
        xout.setNoSpaces(noSpaces);
        DataMap.print(xout, rootTag);
        return sw.toString();
    }
View Full Code Here

     * Write out this DataMap as an XML file
     * @param out
     */
    public void print(OutputStream out){
        if(getAutoDataMap()==null){
            XMLPrinter xout= new XMLPrinter(out);
            DataMap.print(xout,rootTag);
        }else{
            getAutoDataMap().printDataLoadXML(out);
        }
    }
View Full Code Here

     * @return
     * @throws Exception
     */   
  public void convertDecisionTables(RuleSet ruleset ,String destinationFile) throws Exception{
        OutputStream os = new FileOutputStream(destinationFile);
      XMLPrinter out = new XMLPrinter("decision_tables", os);
      String directory = ruleset.getExcel_dtfolder();
      Iterator<String> includes = ruleset.getIncludedRuleSets().iterator();
      while(directory != null){
          directory = ruleset.getSystemPath()+"/"+directory;
          StringBuffer conversion = convertFiles(new File(directory),out,0);
          if(conversion != null){
              System.out.print(conversion);
          }else{
              System.out.println("No Decision Tables Found");
          }
          if(includes.hasNext()){
              String nextDirectory = includes.next();
              directory = ruleset.getRulesDirectory().getRuleSet(nextDirectory).getExcel_dtfolder();
          }else{
              directory = null;
          }
      }
      out.close();
      os.close();
    }
View Full Code Here

            }else{
                excelName = null;
            }
        }
       
        XMLPrinter   xptr  = new XMLPrinter(new FileOutputStream(outputXMLName));
        xptr.opentag("entity_data_dictionary","version","2","xmlns:xs","http://www.w3.org/2001/XMLSchema");
        ef.writeAttributes(xptr);
        xptr.close();
    }
View Full Code Here

TOP

Related Classes of com.dtrules.xmlparser.XMLPrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.