convert_points_xml_to_csv
Created: 2014-11-05 14:02:28
Last updated: 2015-05-11 22:12:33
Converts points in XML to CSV format.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (1)
Converts points from XML to CSV. |
Descriptions (1)
Converts points in openModeller XML format into CSV (header: Id, Longitude, Latitude). |
Dependencies (0)
Inputs (1)
Name |
Description |
xml |
Points in XML format. Each point must contain the attributes: Id, X and Y.
|
Processors (2)
Name |
Type |
Description |
xslt |
stringconstant |
Value
#Id,Longitude,Latitude
,,
|
transform_xml |
beanshell |
Scriptimport javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
if ((sourceString == void) || (sourceString == null)) {
throw new RuntimeException("sourceString must be specified");
}
if ((xsltString == void) || (xsltString == null)) {
throw new RuntimeException("xsltString must be specified");
}
StringReader sourceReader = new StringReader(""+sourceString+"");
StringReader xsltReader = new StringReader(xsltString);
Source inSource = new StreamSource(sourceReader);
Source xslSource = new StreamSource(xsltReader);
// the factory pattern supports different XSLT processors
// e.g. set the "javax.xml.transform.TransformerFactory" system property
TransformerFactory tnfFact = TransformerFactory.newInstance();
Transformer tnf = tnfFact.newTransformer(xslSource);
if (tnf == null) {
throw new RuntimeException("Unable to create Transformer");
}
Writer outputWriter = new StringWriter();
tnf.transform(inSource, new StreamResult(outputWriter));
outputString = outputWriter.toString();
outputWriter.close();
sourceReader.close();
xsltReader.close(); |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
transform_xml |
|
sourceString
xsltString
|
outputString
|
Outputs (1)
Name |
Description |
csv |
Comma separated list of points: id, longitude, latitude.
|
Datalinks (3)
Source |
Sink |
xslt:value |
transform_xml:xsltString |
xml |
transform_xml:sourceString |
transform_xml:outputString |
csv |
Uploader
Component Validity
Loading
License
All versions of this Workflow are
licensed under:
Version 1 (earliest)
(of 4)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (1)
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment