You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jb...@apache.org on 2010/06/12 21:39:17 UTC
svn commit: r954094 -
/commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
Author: jbeard
Date: Sat Jun 12 19:39:17 2010
New Revision: 954094
URL: http://svn.apache.org/viewvc?rev=954094&view=rev
Log:
Got stuff working from previous commit. Rhino front-end all hooked up now.
Modified:
commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
Modified: commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js?rev=954094&r1=954093&r2=954094&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/src/scxml/cgf/SCXMLCompiler.js Sat Jun 12 19:39:17 2010
@@ -82,14 +82,8 @@ require.def("src/scxml/cgf/SCXMLCompiler
filterList[i-1].setResult(result);
}
- var firstFilter = filterList[1];
-
- /*
- var xmlProps = OutputPropertiesFactory.getDefaultMethodProperties("text");
- xmlProps.setProperty("indent", "yes");
- xmlProps.setProperty("standalone", "no");
- var serializer = SerializerFactory.getSerializer(xmlProps);
- */
+ var firstFilter = filterList[0];
+ var lastFilter = filterList[filterList.length-1];
var toReturn = options.inFiles.map(function(xmlFile){
@@ -99,14 +93,12 @@ require.def("src/scxml/cgf/SCXMLCompiler
var baos = new ByteArrayOutputStream();
- generatorFilter.setResult(new StreamResult(baos));
+ lastFilter.setResult(new StreamResult(baos));
- var firstFilterTransformer = firstFilter.getTransformer();
- /*
+ var lastFilterTransformer = lastFilter.getTransformer();
for(optName in options){
- firstFilterTransformer.setParameter(optName,options[optName]);
+ lastFilterTransformer.setParameter(optName,options[optName]);
}
- */
// Set up the transformer to process the SAX events generated by the last filter in the chain
var factory= javax.xml.parsers.SAXParserFactory.newInstance();
@@ -118,11 +110,12 @@ require.def("src/scxml/cgf/SCXMLCompiler
// Parse the source XML, and send the parse events to the
// TransformerHandler.
-debugger
reader.parse(xmlFile);
+ //get transformed output
var transformedJs = String(new java.lang.String(baos.toByteArray()));
+ //optionally beautify it
if(options.beautify){
transformedJs = js_beautify(transformedJs);
}