public class IlvXSLConnector extends IlvXMLConnector
IlvXSLConnector
is a subclass of IlvXMLConnector
that can transform a third-party XML format
into the format accepted by the SDM engine using XSLT.
You must specify two XSL templates files: one that will transform the third-party format into the SDM format (the input templates), and another one that will perform the inverse transformation (the output templates).
Here is an example of how to configure the XSL connector in the SDM style sheet:
XMLConnector { class : "ilog.views.sdm.util.IlvXSLConnector"; inputTemplates : "url(thirdparty2sdm.xsl)"; outputTemplates : "url(sdm2thirdparty.xsl)"; }
The output templates should be the inverse of the input templates, so that writing an XML file that has just been read and never modified should produce the original XML file.
You can specify only one template file if you need the XSL connector to work in one direction only (read or write). Note, though, that this is dangerous. For example, if you specify only an input template, reading and then writing the same file will erase the original file and produce an XML file in the wrong format.
If no input templates and no output templates are specified, the XML files are not transformed, and the XSL connector acts as a basic XML connector.
It is the responsibility of the writer of the XSL templates to ensure that the transformation is correct and that no information is lost.
LOOSE_FORMAT, STRICT_FORMAT
Constructor and Description |
---|
IlvXSLConnector()
Creates a new
IlvXSLConnector with no
input and output templates. |
Modifier and Type | Method and Description |
---|---|
protected void |
buildDOM(Document document,
IlvSDMModel model,
Enumeration objects)
Builds a DOM tree transformed using the output XSL templates.
|
void |
clearInputParameters()
This method clears the parameters passed to the input transformation.
|
void |
clearOutputParameters()
This method clears the parameters passed to the output transformation.
|
String |
getInputTemplates()
Returns the location of the XSLT templates file used to
transform the third-party XML input format into the SDM format.
|
String |
getOutputTemplates()
Returns the location of the XSLT templates file used to
transform the SDM output format into the third-party XML output format.
|
protected void |
initXMLReader(XMLReader reader)
Initializes an XSL transformer that will transform the XML input
using the input templates.
|
protected void |
parse(Document document)
Transforms the document using the input XSL templates, and
calls the superclass to parse the transformed document.
|
void |
setInputParameter(String name,
Object value)
This method allows you to pass parameters to the input transformation.
|
void |
setInputTemplates(String inputTemplatesURI)
Sets the location of the XSLT templates file used to
transform the third-party XML input format into the SDM format.
|
void |
setOutputParameter(String name,
Object value)
This method allows you to pass parameters to the output transformation.
|
void |
setOutputTemplates(String outputTemplatesURI)
Sets the location of the XSLT templates file used to
transform the SDM output format into the third-party XML output format.
|
addForwardRef, addObject, createLink, createNode, getEngine, getMetadata, getModel, getOutputFormat, getParent, getPublicDTDId, getRootElementTag, getSystemDTDId, initParser, isCheckingRootElementTag, isIncremental, isSavingDTD, isSavingPropertyTypes, isValidating, parse, parseProcessingInstruction, readDOM, readXML, readXML, readXML, resolveForwardRefs, setCheckingRootElementTag, setEngine, setFrom, setFrom, setID, setIncremental, setMetadata, setOutputFormat, setParent, setProperty, setPublicDTDId, setRootElementTag, setSavingDTD, setSavingPropertyTypes, setSystemDTDId, setTo, setTo, setValidating, writeDOM, writeXML, writeXML
public IlvXSLConnector()
IlvXSLConnector
with no
input and output templates.public void setInputTemplates(String inputTemplatesURI)
inputTemplatesURI
- The input templates URI.public String getInputTemplates()
public void setOutputTemplates(String outputTemplatesURI)
outputTemplatesURI
- The output templates URI.public String getOutputTemplates()
public void setInputParameter(String name, Object value)
name
- The name of the parameter.value
- The value of the parameter.public void clearInputParameters()
public void setOutputParameter(String name, Object value)
name
- The name of the parameter.value
- The value of the parameter.public void clearOutputParameters()
protected void initXMLReader(XMLReader reader)
initXMLReader
in class IlvXMLConnector
reader
- The SAX2 XML reader.protected void parse(Document document) throws IlvSDMException
parse
in class IlvXMLConnector
document
- The document to parse.IlvSDMException
protected void buildDOM(Document document, IlvSDMModel model, Enumeration objects)
buildDOM
in class IlvXMLConnector
document
- The DOM document in which the DOM
tree must be built. The document is initially empty:
you must create and add the root element yourself.model
- The SDM data model that is being saved.objects
- The objects of the data model that must
be saved.IlvXMLConnector.setSavingDTD(boolean)
,
IlvXMLConnector.setPublicDTDId(java.lang.String)
,
IlvXMLConnector.setSystemDTDId(java.lang.String)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.