XSLT is the simplest solution for reading and writing
custom XML formats, because it requires no Java™
coding.
This solution is easier to apply when the structure of the custom
XML format is relatively close to the required structure.
For documentation and resources on XSLT, see the W3C
website (
http://www.w3c.org).
Proceed as follows:
Write two XSLT files: one that will
convert an XML document from the custom format to the SDM format (for
reading), and another one that will convert a document from the SDM
format to the custom format (for writing).
Create an instance of the class
IlvXSLConnector (a subclass of
IlvXMLConnector), specifying the two XSLT files. To do this through
the style sheet add a rule with the following structure:
XMLConnector{
class : "ilog.views.sdm.util.IlvXSLConnector";
inputTemplates : "url(custom2sdm.xsl)";
outputTemplates : "url(sdm2custom.xsl)";
}
where the two XSLT files are custom2sdm.xsl
(for
reading), and sdm2custom.xsl
for writing.
Note that the two XSLT files must be written so that
no information is lost, that is, the two transformations should be
the exact inverse of one another. If the custom XML format contains
information that is not useful for Rogue Wave JViews
Diagrammer purposes or that cannot be translated easily, this information
can be stored as metadata (see
Metadata in the XML data file in
Using the Designer).
It is possible to specify only one transformation. For
example, you may specify only the input templates file if you read
only custom XML files, but never modify and write them back.