Package net.loomchild.segment.srx.io
Class Srx1Transformer
- java.lang.Object
-
- net.loomchild.segment.srx.io.Srx1Transformer
-
- All Implemented Interfaces:
SrxTransformer
public class Srx1Transformer extends java.lang.Object implements SrxTransformer
Represents SRX document transformer between SRX 1.0 and newest supported version. Responsible for validating input as SRX 1.0 and doing the transformation using XSLT stylesheet.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MAP_RULE_NAME
Transformation parameter.private static javax.xml.validation.Schema
schema
private static java.lang.String
SCHEMA
private static java.lang.String
STYLESHEET
private static javax.xml.transform.Templates
templates
-
Constructor Summary
Constructors Constructor Description Srx1Transformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
transform(java.io.Reader reader, java.io.Writer writer, java.util.Map<java.lang.String,java.lang.Object> parameterMap)
Transform given SRX 1.0 document to newest supported version and write it to given writer.java.io.Reader
transform(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.Object> parameterMap)
Transforms given SRX 1.0 document and returns Reader containing SRX document in newest supported version.
-
-
-
Field Detail
-
MAP_RULE_NAME
public static final java.lang.String MAP_RULE_NAME
Transformation parameter. Used to select map rule in SRX 1.0 document.- See Also:
- Constant Field Values
-
STYLESHEET
private static final java.lang.String STYLESHEET
- See Also:
- Constant Field Values
-
SCHEMA
private static final java.lang.String SCHEMA
- See Also:
- Constant Field Values
-
templates
private static javax.xml.transform.Templates templates
-
schema
private static javax.xml.validation.Schema schema
-
-
Method Detail
-
transform
public void transform(java.io.Reader reader, java.io.Writer writer, java.util.Map<java.lang.String,java.lang.Object> parameterMap)
Transform given SRX 1.0 document to newest supported version and write it to given writer. Because in current SRX version only one map rule is allowed it must be selected from SRX 1.0 document. If parameter map contains parameterMAP_RULE_NAME
then only map rule with name given by this parameter value is preserved. Otherwise first map rule from source document is preserved. If source document does not contain appropriate map rule to select, resulting document will not contain language maps and will be unusable.- Specified by:
transform
in interfaceSrxTransformer
- Parameters:
reader
- reader containing SRX 1.0 documentwriter
- writer to write transformed SRX documentparameterMap
- map containing transformation parameters
-
transform
public java.io.Reader transform(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.Object> parameterMap)
Transforms given SRX 1.0 document and returns Reader containing SRX document in newest supported version. Creates temporary file and usestransform(Reader, Writer, Map)
.- Specified by:
transform
in interfaceSrxTransformer
- Parameters:
reader
- reader containing SRX 1.0 documentparameterMap
- map containing transformation parameters.- Returns:
- reader containing SRX document in newest supported version
- See Also:
transform(Reader, Writer, Map)
-
-