corpus-services  1.0
CMDI2SolrXML.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 package de.uni_hamburg.corpora.conversion;
8 
11 import javax.xml.transform.TransformerConfigurationException;
12 import javax.xml.transform.TransformerException;
13 
18 public class CMDI2SolrXML {
19 
22  static final String STYLESHEET_PATH = "/xsl/CMDI2SolrDocument.xsl";
23 
24 
25 
26  public String convert(String cmdiString) throws TransformerConfigurationException, TransformerException {
27 
28  // read the XSL stylesheet into a String
29  String xsl = TypeConverter.InputStream2String(getClass().getResourceAsStream(STYLESHEET_PATH));
30 
31  // perform XSLT transformation
32  XSLTransformer xt = new XSLTransformer();
33  String result = xt.transform(cmdiString, xsl);
34 
35  return result;
36 
37  }
38 
39 
40 }
static String InputStream2String(InputStream is)