Package org.sintef.umt.transformer

Examples of org.sintef.umt.transformer.XMLUtility


            }
            // System.out.println (buffer);
            if (_transformationcontext == null) {
              tre.setInputSource (new StringReader(buffer));
            } else {
              XMLUtility xmlutil = new XMLUtility();
              String nodename = _transformationcontext.getNodeName();
              String nodeid = _transformationcontext.getAttribute("id");
              Document owner = _transformationcontext.getOwnerDocument();
              Element docel = owner.getDocumentElement();
              StringWriter swriter = new StringWriter ();
View Full Code Here


      resolve_locations.add(location.getParent());
    }
  } 
 
    public Collection read(Reader reader){
      XMLUtility utility = new XMLUtility ();
      Collection collection = utility.readXML(reader);
      utility = null;
    return collection;
  }
View Full Code Here

  public void validateAgainstSchema(String XMLFileName, String XMLSchemaFileName) throws Exception{
    // Need to make the xml-schema case-insensitive.
    // for this we use a nifty little xslt transformation from IBM
    if (CASE_SENSITIVE){
      try
        XMLUtility xmlutil = new XMLUtility();
        // xmlutil.addLookupPath(UMTMain.resource_dir);
        File schemaFile = new File(XMLSchemaFileName);
        File convertFile = new File(UMTMain.resource_dir + "convert-enumerations.xsl");
        String insensitiveSchema = xmlutil.transform(schemaFile,convertFile);
        FileWriter writer = new FileWriter (new File("insensitive_"+XMLSchemaFileName))
        writer.write(insensitiveSchema);
        writer.close();
        writer = null;   
      } catch (Exception ex) {
View Full Code Here

         add (_editor, BorderLayout.CENTER);
 
 
  public void readXML (File xmlsource) {
    try {
      XMLUtility util = new XMLUtility (_listener);       
      Collection coll = util.readXML(new FileReader(xmlsource));
      if (coll.size() > 0) {
        setModelElements (coll);
        Node docnode = (Node)(coll.iterator().next());
        _editor.setStyledInput(docnode);
      //  util.doParseValidate(new FileReader(xmlsource));
View Full Code Here

            hutneditor.openHutnReader(new StringReader (String.valueOf(data)), "");
            hutntext.setStyledInput(String.valueOf(data), "XMI-Light representation");
          } catch (Exception ex){
            output.addLine ("Error reading file: " + _inputFile.getAbsolutePath() + " - " + ex.getMessage ());
          }   
          XMLUtility util = new XMLUtility (output)
          util.addLookupPath(UMTMain.resource_dir);
          if (!UMTMain.environmentIsEmbedded())
            util.doSAXParseValidate(hutntext.getReader());
          hutneditor.setLoading(false);       
      } else if (name.equalsIgnoreCase("openXmiLightString")) {
          hutneditor.setLoading(true);
          Reader r = new StringReader (_buffer);
          hutneditor.openHutnReader(r, "");
          hutntext.setStyledInput(_buffer, "Reversed XMI Light")
          XMLUtility util = new XMLUtility (output)
          util.addLookupPath(UMTMain.resource_dir);
          if (!UMTMain.environmentIsEmbedded())
            util.doSAXParseValidate(hutntext.getReader());
          hutneditor.setLoading(false);         
      }
      setPositionForTextView(0);     
    } catch (Exception ex) {
      hutneditor.setLoading(false);
View Full Code Here

        xsltfile = new File (xmi2xmilight);
      else
        xsltfile = new File (uml2xmi2xmilight);
      // TODO : remove copyResourcesToTarget
      // copyResourcesToTarget (xmisource);   
      XMLUtility xmlutility = new XMLUtility(output);
      xmlutility.addLookupPath(UMTMain.resource_dir);     
      hutn = xmlutility.transform(xmisource, xsltfile)
//      if (!UMTMain.environmentIsEmbedded())
      xmlutility.doSAXParseValidate(new StringReader(hutn));
      xmlutility = null;
      xsltfile = null;
    } catch (Exception ex) {
      output.addLine("Error occured in XMI transformation." + ex.getMessage());
    }
View Full Code Here

   */
  public String xmiTransform (Reader xmisource) {
    String hutn = null;   
    try {
      File xsltfile = new File (xmi2xmilight);
      XMLUtility xmlutility = new XMLUtility(output);
      xmlutility.addLookupPath(UMTMain.resource_dir);
      if (xsltfile.getParentFile() != null)
        xmlutility.addLookupPath(xsltfile.getParentFile().getAbsolutePath());
      Reader xsltreader = null;
      try {
        xsltreader = new FileReader (xsltfile);
      } catch (IOException ioex) {
      }
      hutn = xmlutility.transform(xmisource, xsltreader);
      xmlutility.doSAXParseValidate(new StringReader(hutn));
      xmlutility = null; xsltfile = null;
    } catch (Exception ex) {     
    }
   
    return hutn;
View Full Code Here

    try {
      Reader xmilight = hutntext.getReader();
      String xslt = UMTMain.resource_dir + UMTMain.getResourceName("transformation.xmilight2xmi");
      File xsltfile = new File (xslt);
      FileReader xsltreader = new FileReader (xsltfile);
      XMLUtility xmlutility = new XMLUtility (output);     
      xmlutility.transform(xmilight, xsltreader, xmiwriter);     
    } catch (Exception ex) {
      System.out.println (ex);
    }
  }
View Full Code Here

  }

  public String doTransform (Reader source, Reader transformsource)
  {
    StringWriter resultwriter = new StringWriter ();
    XMLUtility xmlutility = null;   
    try{
      xmlutility = new XMLUtility (output);
      String result = xmlutility.transform(source, transformsource);
      return result;     
    } catch (Exception ex) {
      System.out.println ("doTransform::" + ex);
    }
    xmlutility = null;
View Full Code Here

        System.out.println (ioex);
      }     
      hutntext.setHutnInput (nonxml, "'PIM' Representation");
    } else if (source.getActionCommand().equalsIgnoreCase("validate")) {
      output.clear();
      XMLUtility xmlutility = new XMLUtility (output);
      xmlutility.addLookupPath(UMTMain.resource_dir);     
      xmlutility.doSAXParseValidate(hutntext.getReader());
    } else if (source.getActionCommand().equalsIgnoreCase("increaseFont")){
      hutntext.increaseFont();
    } else if (source.getActionCommand().equalsIgnoreCase("decreaseFont")) {
      hutntext.decreaseFont();
    } else {
View Full Code Here

TOP

Related Classes of org.sintef.umt.transformer.XMLUtility

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.