Package edu.mit.csail.sdg.alloy4

Examples of edu.mit.csail.sdg.alloy4.XMLNode


        }
    }

    /** Validate the given filename to see if it is a valid Alloy XML instance file. */
    private static void validate(String filename) throws Exception {
        A4SolutionReader.read(new ArrayList<Sig>(), new XMLNode(new File(filename))).toString();
        StaticInstanceReader.parseInstance(new File(filename));
    }
View Full Code Here


      }
   }

   /** Parse the file into an AlloyInstance if possible. */
   private StaticInstanceReader(XMLNode root) throws Err {
      XMLNode inst = null;
      for(XMLNode sub: root) if (sub.is("instance")) { inst=sub; break; }
      if (inst==null) throw new ErrorSyntax("The XML file must contain an <instance> element.");
      boolean isMeta = "yes".equals(inst.getAttribute("metamodel"));
      A4Solution sol = A4SolutionReader.read(new ArrayList<Sig>(), root);
      for (Sig s:sol.getAllReachableSigs()) if (s instanceof PrimSig && ((PrimSig)s).parent==Sig.UNIV) toplevels.add((PrimSig)s);
      if (!isMeta) {
         sig2type.put(Sig.UNIV, AlloyType.UNIV);
         sig2type.put(Sig.SIGINT, AlloyType.INT);
View Full Code Here

   }

   /** Parse the file into an AlloyInstance if possible. */
   public static AlloyInstance parseInstance(File file) throws Err {
      try {
         return (new StaticInstanceReader(new XMLNode(file))).ans;
      } catch(IOException ex) {
         throw new ErrorFatal("Error reading the XML file: " + ex, ex);
      }
   }
View Full Code Here

   }

   /** Parse the file into an AlloyInstance if possible, then close the Reader afterwards. */
   public static AlloyInstance parseInstance(Reader reader) throws Err {
      try {
         return (new StaticInstanceReader(new XMLNode(reader))).ans;
      } catch(IOException ex) {
         throw new ErrorFatal("Error reading the XML file: " + ex, ex);
      }
   }
View Full Code Here

   /** Read the XML file and merge its settings into an existing VizState object. */
   public static void readAlloy(String filename, VizState theme) throws IOException {
      File file = new File(filename);
      try {
         XMLNode elem = new XMLNode(file);
         for(XMLNode sub: elem.getChildren("view")) parseView(sub,theme);
      } catch(Throwable e) {
         throw new IOException("The file \""+file.getPath()+"\" is not a valid XML file, or an error occurred in reading.");
      }
   }
View Full Code Here

     }      
     return ret;
  }
 
  public static XMLNode getNode(String xPathPattern) {
     XMLNode ret = null;
     try {
         ret = (XMLNode) rootConfigNode.selectSingleNode(xPathPattern);
     } catch (Exception e) {
         System.out.println(e.toString());
     }
View Full Code Here

         

          //parcoure des nodes
          NodeList nl =  n.getChildNodes();
          for (int i = 0; i < nl.getLength(); i++) {
             XMLNode theNode = (XMLNode) nl.item(i);
             if (theNode.getNodeName().compareTo("#text")!=0) {
               if (theNode.getNodeName().compareTo("#document")!=0){
               infoNode(theNode , xpath + theNode.getNodeName()+"/");
               } else {
               infoNode(theNode , xpath );
               }
             }
           }
View Full Code Here

 
      Run run = new Run(args);
      
     try {
    
      XMLNode lstLogSourceNode = (XMLNode) xmlConfig.getNode("/log4plsql");
      NodeList listLogSource = lstLogSourceNode.selectNodes("logSource");
      XMLNode theLogSource;
      dbLogger.debug("Nbr backgroundProcess to launch :"+listLogSource.getLength());
      if (listLogSource.getLength() < 1 )
        dbLogger.error("No backgroundProcess to launch");
      for (int i=0; i<listLogSource.getLength(); i++){
        dbLogger.debug("start " + i + " backgroundProcess");
View Full Code Here

        }
    }

    public void transform(Node sourceNode, ContentHandler resultContentHandler) throws XMLPlatformException {
        try {
            XMLNode xmlNode = (XMLNode)sourceNode;
            xmlNode.reportSAXEvents(resultContentHandler);
        } catch (SAXException e) {
            throw XMLPlatformException.xmlPlatformTransformException(e);
        }
    }
View Full Code Here

            } else {
                xmlDocument.setEncoding(getEncoding());
                xmlDocument.setVersion(getVersion());
            }

            XMLNode xmlNode = (XMLNode)sourceNode;
            PrintWriter printWriter = new PrintWriter(resultWriter);
            XDKPrintDriver xdkPrintDriver = new XDKPrintDriver(printWriter);
            xdkPrintDriver.setFormattedOutput(isFormattedOutput());
            xdkPrintDriver.setEncoding(getEncoding());
            xdkPrintDriver.print(xmlNode);
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4.XMLNode

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.