ilog.views.sdm.util
Class IlvXSLConnector

java.lang.Object
  extended by ilog.views.sdm.util.IlvXMLConnector
      extended by ilog.views.sdm.util.IlvXSLConnector
All Implemented Interfaces:
Serializable

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.

Since:
JViews 5.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.views.sdm.util.IlvXMLConnector
LOOSE_FORMAT, STRICT_FORMAT
 
Constructor Summary
IlvXSLConnector()
          Creates a new IlvXSLConnector with no input and output templates.
 
Method Summary
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.
 
Methods inherited from class ilog.views.sdm.util.IlvXMLConnector
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvXSLConnector

public IlvXSLConnector()
Creates a new IlvXSLConnector with no input and output templates.

Method Detail

setInputTemplates

public 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.

Parameters:
inputTemplatesURI - The input templates URI.

getInputTemplates

public String getInputTemplates()
Returns the location of the XSLT templates file used to transform the third-party XML input format into the SDM format.


setOutputTemplates

public 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.

Parameters:
outputTemplatesURI - The output templates URI.

getOutputTemplates

public String getOutputTemplates()
Returns the location of the XSLT templates file used to transform the SDM output format into the third-party XML output format.


setInputParameter

public void setInputParameter(String name,
                              Object value)
This method allows you to pass parameters to the input transformation.

Parameters:
name - The name of the parameter.
value - The value of the parameter.
Since:
JViews 6.0

clearInputParameters

public void clearInputParameters()
This method clears the parameters passed to the input transformation.

Since:
JViews 6.0

setOutputParameter

public void setOutputParameter(String name,
                               Object value)
This method allows you to pass parameters to the output transformation.

Parameters:
name - The name of the parameter.
value - The value of the parameter.
Since:
JViews 6.0

clearOutputParameters

public void clearOutputParameters()
This method clears the parameters passed to the output transformation.

Since:
JViews 6.0

initXMLReader

protected void initXMLReader(XMLReader reader)
Initializes an XSL transformer that will transform the XML input using the input templates.

Overrides:
initXMLReader in class IlvXMLConnector
Parameters:
reader - The SAX2 XML reader.

parse

protected void parse(Document document)
              throws IlvSDMException
Transforms the document using the input XSL templates, and calls the superclass to parse the transformed document.

Overrides:
parse in class IlvXMLConnector
Parameters:
document - The document to parse.
Throws:
IlvSDMException

buildDOM

protected void buildDOM(Document document,
                        IlvSDMModel model,
                        Enumeration objects)
Builds a DOM tree transformed using the output XSL templates.

Overrides:
buildDOM in class IlvXMLConnector
Parameters:
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.
See Also:
IlvXMLConnector.setSavingDTD(boolean), IlvXMLConnector.setPublicDTDId(java.lang.String), IlvXMLConnector.setSystemDTDId(java.lang.String)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.