public class IlvXMLConnector extends Object implements Serializable
Here is an example that illustrates the format of the XML SDM files:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE SDM> <SDM> <activity id="1"> <property name="label">Activity 1</property> <property name="x">291.125</property> <property name="y">56.375</property> </activity> <activity id="2"> <property name="label">Activity 2</property> <property name="x">195.33594</property> <property name="y">87.375</property> </acivity> <transition id="3" islink="true" from="1" to="2" /> </SDM>
If you need to read and write XML files with another format,
you can subclass IlvXMLConnector
and associate an instance
of your subclass with an SDM engine using the method
IlvSDMEngine.setXMLConnector(ilog.views.sdm.util.IlvXMLConnector)
.
You can also replace the XML connector class used by an SDM engine by adding a rule like the following in the style sheet:
XMLConnector { class : "mypackage.MyXMLConnector"; }
The main entry points to IlvXMLConnector
are
readXML(ilog.views.sdm.IlvSDMModel,java.io.InputStream,boolean,java.util.Hashtable)
,
readXML(ilog.views.sdm.IlvSDMModel,java.io.Reader,boolean,java.util.Hashtable)
,
readXML(ilog.views.sdm.IlvSDMModel,java.lang.String,boolean,java.util.Hashtable)
,
and writeXML
.
The default implementation of the readXML
method uses
a SAX parser to read the XML source. To modify the way
the XML source is read, you can:
initXMLReader
method. In your
implementation, you can set your own document handler
to interpret your XML format.
parse(org.xml.sax.InputSource)
method. This allows
you to read the XML file a completely different
way, for example by loading a DOM tree.
The class IlvXMLConnector
provides utility methods
to create the objects read from the XML file and to
set their properties. These utility methods are:
IlvXMLConnector
to read your own
XML format, you should call these methods instead of calling
the IlvSDMModel
methods directly.
The default implementation of writeXML
creates a copy of the SDM model as a DOM tree, and then writes
this DOM tree to the XML output stream. To modify the
output format, you can override the buildDOM
method.
The XML connector can also read and write data to/from an existing DOM document,
through the methods
readDOM
and
writeDOM
.
The XML connector serializes and deserializes the properties of the SDM model
objects using the IlvConvert
class. If a
property value is not a String, it is converted to a String, and its class
is saved as the type
attribute of the property
element in the XML file. When the XML stream is read back, the property will
be converted back to the saved type. If you use object properties that
have a custom type, you can register a converter from String to your custom
class and the inverse using the
IlvConvert.addConverter(ilog.views.util.convert.IlvConverter)
method.
IlvSDMEngine.setXMLFile(java.lang.String)
,
IlvSDMEngine.readXML(java.io.Reader)
,
IlvSDMEngine.readXML(java.io.InputStream)
,
IlvSDMEngine.readXML(java.lang.String)
,
IlvSDMEngine.writeXML(java.io.OutputStream)
,
IlvSDMEngine.writeXML(java.io.Writer)
,
IlvSDMEngine.readDOM(org.w3c.dom.Document)
,
IlvSDMEngine.writeDOM(org.w3c.dom.Document)
,
Serialized FormModifier and Type | Field and Description |
---|---|
int |
LOOSE_FORMAT
Identifies the output format in which XML elements describing
the objects of the data model can have any XML tag.
|
int |
STRICT_FORMAT
Identifies the output format in which XML elements describing
the nodes of the data model always have the XML tag
"node" ,
and those describing the links of the data model always have the XML tag "link" . |
Constructor and Description |
---|
IlvXMLConnector()
Creates a new
IlvXMLConnector . |
Modifier and Type | Method and Description |
---|---|
protected void |
addForwardRef(Object link,
String id,
boolean to)
This helper method implements forward references in the
XML input source.
|
protected void |
addObject(Object object,
Object parent)
Adds an object that has been read from the XML source or document
to the SDM data model.
|
protected void |
buildDOM(Document document,
IlvSDMModel model,
Enumeration objects)
This method is called by
writeXML
to build a DOM tree that represents the specified SDM data model. |
protected Object |
createLink(String tag)
Creates a new link in the SDM data model.
|
protected Object |
createNode(String tag)
Creates a new node in the SDM data model.
|
IlvSDMEngine |
getEngine()
Returns the calling engine.
|
IlvMModel |
getMetadata()
Returns the last metadata found.
|
protected IlvSDMModel |
getModel()
Returns the SDM data model that is currently being read
or written.
|
int |
getOutputFormat()
Returns the output format of the XML files
generated by this XML connector.
|
Object |
getParent()
Returns the parent object.
|
String |
getPublicDTDId()
|
String |
getRootElementTag()
Returns the tag of the root element of the documents
generated by this XML connector.
|
String |
getSystemDTDId()
|
protected void |
initParser(Parser parser)
Deprecated.
Since JViews 5.0, you should override the method
initXMLReader(org.xml.sax.XMLReader) instead. |
protected void |
initXMLReader(XMLReader reader)
This method is called by
parse(org.xml.sax.InputSource) to initialize
the SAX2 XML reader. |
boolean |
isCheckingRootElementTag()
Returns
true if this connector checks that the XML document's
root element has the tag specified by setRootElementTag(java.lang.String) . |
boolean |
isIncremental()
Returns the flag specifying whether reading an XML file
creates new objects or just sets the properties of
existing objects.
|
boolean |
isSavingDTD()
Sets the flag specifying whether the XML connector
saves the DTD public and system identifiers in
the
DOCTYPE declaration of the XML document. |
boolean |
isSavingPropertyTypes()
Returns
true if this XML connector saves the types of
properties to the XML stream. |
boolean |
isValidating()
Returns the validating state of the XML parser.
|
protected void |
parse(Document document)
Parses a DOM document.
|
protected void |
parse(InputSource in)
Parses an XML input source.
|
protected void |
parseProcessingInstruction(String data)
Parses a processing instruction whose target is
"sdm" . |
Enumeration |
readDOM(IlvSDMModel model,
Document document,
boolean insert,
Hashtable properties)
Reads an SDM model from a DOM document.
|
Enumeration |
readXML(IlvSDMModel model,
InputStream in,
boolean insert,
Hashtable properties)
Reads an SDM model from an XML input stream.
|
Enumeration<?> |
readXML(IlvSDMModel model,
Reader reader,
boolean insert,
Hashtable properties)
Reads an SDM model from an XML input stream.
|
Enumeration |
readXML(IlvSDMModel model,
String url,
boolean insert,
Hashtable properties)
Reads an SDM model from an XML input URL.
|
protected void |
resolveForwardRefs(Object node,
String id)
Resolves a forward reference to a source or destination node.
|
void |
setCheckingRootElementTag(boolean check)
Enables/disables the checking of the tag of the XML document's root element.
|
void |
setEngine(IlvSDMEngine engine)
Sets the calling engine.
|
protected void |
setFrom(Object link,
Object from)
Sets the source of a link.
|
protected void |
setFrom(Object link,
String id)
Sets the source of a link.
|
protected String |
setID(Object obj,
String id)
Sets the identifier of an object.
|
void |
setIncremental(boolean incremental)
Specifies whether reading an XML file should always
create new objects or just set the properties of
existing objects.
|
void |
setMetadata(IlvMModel model)
Sets metadata, to be saved in the next
writeXML . |
void |
setOutputFormat(int format)
Sets the format of the XML files
generated by this XML connector.
|
void |
setParent(Object parent)
Sets the parent object.
|
protected void |
setProperty(Object object,
String name,
Object value)
Sets a property of an object.
|
void |
setPublicDTDId(String id)
|
void |
setRootElementTag(String tag)
Sets the tag of the root element of the documents
generated by this XML connector.
|
void |
setSavingDTD(boolean savingDTD)
Sets the flag specifying whether the XML connector
saves the DTD public and system identifiers in
the
DOCTYPE declaration of the XML document. |
void |
setSavingPropertyTypes(boolean savingPropertyTypes)
Specifies whether the types of the properties are saved to the XML
stream or not.
|
void |
setSystemDTDId(String id)
|
protected void |
setTo(Object link,
Object to)
Sets the destination of a link.
|
protected void |
setTo(Object link,
String id)
Sets the destination of a link.
|
void |
setValidating(boolean validating)
Sets the XML parser to validating or nonvalidating mode.
|
void |
writeDOM(IlvSDMModel model,
Document document,
Enumeration objects,
Hashtable properties)
Writes a set of objects from an SDM model to a DOM document.
|
void |
writeXML(IlvSDMModel model,
OutputStream out,
Enumeration objects,
Hashtable properties)
Writes a set of objects from an SDM model to an XML output stream.
|
void |
writeXML(IlvSDMModel model,
Writer writer,
Enumeration objects,
Hashtable properties)
Writes a set of objects from an SDM model to an XML writer.
|
public int STRICT_FORMAT
"node"
,
and those describing the links of the data model always have the XML tag "link"
.setOutputFormat(int)
public int LOOSE_FORMAT
setOutputFormat(int)
public void setOutputFormat(int format)
format
is STRICT_FORMAT
, the nodes of the graph
are always saved as XML elements of tag "node"
, and the links
are always saved as XML elements of tag "link"
.
The symbolic type of the objects
(as returned by the IlvSDMModel.getTag(java.lang.Object)
method) is saved as an attribute of name "type"
.
format
is LOOSE_FORMAT
, the format
is slightly different: all the objects are saved as XML elements
whose tag is the SDM symbolic type returned by the IlvSDMModel.getTag(java.lang.Object)
method. This format cannot generally be described using a DTD, but
it is easier to read.
IlvXMLConnector
accepts both formats when it
reads an XML source or document.
The output format is set according to the format
of the input file.
The default value is LOOSE_FORMAT
.
format
- The format of the XML files.public int getOutputFormat()
setOutputFormat(int)
public void setSavingDTD(boolean savingDTD)
DOCTYPE
declaration of the XML document.
By default, the flag is false
: no DTD is saved.savingDTD
- If true
,
the writeXML
method saves the DTD identifiers returned by getPublicDTDId()
and getSystemDTDId()
in the DOCTYPE
declaration of the XML document.
Otherwise, no DTD identifiers are saved (the DOCTYPE
declaration contains only the tag name of the root element,
returned by getRootElementTag()
).public boolean isSavingDTD()
DOCTYPE
declaration of the XML document.setSavingDTD(boolean)
public void setValidating(boolean validating)
validating
- The validating flag.public boolean isValidating()
public boolean isSavingPropertyTypes()
true
if this XML connector saves the types of
properties to the XML stream.setSavingPropertyTypes(boolean)
public void setSavingPropertyTypes(boolean savingPropertyTypes)
If this flag is set to true
, for properties
whose values are not String, the class is saved to the XML stream as the
type
attribute of the property
element.
When the XML stream is read back, the property value is converted back from
String to the saved type. This mechanism allows nonString properties to be
saved to XML files.
By default, the flag is false
, so property types are not
saved.
savingPropertyTypes
- If true
, for properties
whose values are not String, the class is saved to the XML stream as the
type
attribute of the property
element.
When the XML stream is read back, the value is converted back from
String to the saved type. This mechanism allows for nonString properties to be
saved to XML files.public void setPublicDTDId(String id)
DOCTYPE
declaration if isSavingDTD()
returns true
.
The default public DTD identifier is
"-//ILOG//JViews/SDM 4.0"
.
id
- The public DTD identifier.setSavingDTD(boolean)
,
getPublicDTDId()
public String getPublicDTDId()
public void setSystemDTDId(String id)
DOCTYPE
declaration if isSavingDTD()
returns true
.
The default system DTD identifier is
"sdm.dtd"
.
id
- The system DTD identifier.setSavingDTD(boolean)
,
getSystemDTDId()
public void setRootElementTag(String tag)
By default, the tag is "SDM"
.
The tag is updated when a file with a different
root element tag is read.
tag
- The root element tag.public String getRootElementTag()
public boolean isCheckingRootElementTag()
true
if this connector checks that the XML document's
root element has the tag specified by setRootElementTag(java.lang.String)
.setCheckingRootElementTag(boolean)
public void setCheckingRootElementTag(boolean check)
If checking is enabled, the readXML(ilog.views.sdm.IlvSDMModel, java.lang.String, boolean, java.util.Hashtable)
and readDOM(ilog.views.sdm.IlvSDMModel, org.w3c.dom.Document, boolean, java.util.Hashtable)
methods check
that the tag of the document's root element is the tag specified by
setRootElementTag(java.lang.String)
. If the tag is not correct, an exception of
type IlvNotAnSDMDocumentException
is thrown.
Note:: The tag "SDM"
is always accepted, even if
another tag was specified through setRootElementTag(java.lang.String)
.
check
- If true
, the connector will check when reading an XML
stream that the root element has the tag specified by setRootElementTag(java.lang.String)
.
If the element tag is wrong, the readXML(ilog.views.sdm.IlvSDMModel, java.lang.String, boolean, java.util.Hashtable)
method and its variants will
throw an IlvNotAnSDMDocumentException
.public String getSystemDTDId()
public void setIncremental(boolean incremental)
incremental
- If this parameter is false
,
every XML element read from the input source will cause
a new object to be created and added to the SDM model.
If this parameter is true
, the XML connector
looks for an existing object with the same identifier.
If the object already exists in the SDM model, no new object
is created: its properties are simply updated according
to the contents of the XML source.public boolean isIncremental()
public void setParent(Object parent)
null
after each read operation.parent
- The parent object.public Object getParent()
setParent(java.lang.Object)
public Enumeration readXML(IlvSDMModel model, String url, boolean insert, Hashtable properties) throws IlvSDMException, IOException
IlvSDMModel.isEditable()
method must
return true
,
and the editing methods (IlvSDMModel.addObject(java.lang.Object, java.lang.Object, java.lang.Object)
,
IlvSDMModel.removeObject(java.lang.Object)
, and
IlvSDMModel.setObjectProperty(java.lang.Object, java.lang.String, java.lang.Object)
) must be implemented.
This method calls the parse(org.xml.sax.InputSource)
method
that reads the XML input source using a SAX parser.
model
- The SDM model to which the objects read from the XML file will be added.url
- The URL to read from.insert
- Must be true
if the objects are
read into a nonempty model.properties
- If non-null
, the processing
instruction <?sdm prop1="value1" prop2="value2"?>
is parsed
(if present), and the properties that it contains are stored in
the Hashtable
parameter.insert
is true
, this
method returns an enumeration of the objects read from the XML source.
Otherwise, the method returns null
.IlvNotAnSDMDocumentException
- if the root element of the XML document
does not have the tag specified by setRootElementTag(java.lang.String)
, and if
setCheckingRootElementTag(true)
was called.IlvSDMException
- if the model is not editable, or if an
error occurred while reading or parsing the XML file.IOException
- if an I/O error occurred.readXML(ilog.views.sdm.IlvSDMModel,java.io.InputStream,boolean,java.util.Hashtable)
,
readXML(ilog.views.sdm.IlvSDMModel,java.io.Reader,boolean,java.util.Hashtable)
,
readDOM(ilog.views.sdm.IlvSDMModel,org.w3c.dom.Document,boolean,java.util.Hashtable)
public Enumeration readXML(IlvSDMModel model, InputStream in, boolean insert, Hashtable properties) throws IlvSDMException, IOException
IlvSDMModel.isEditable()
method must
return true
,
and the editing methods (IlvSDMModel.addObject(java.lang.Object, java.lang.Object, java.lang.Object)
,
IlvSDMModel.removeObject(java.lang.Object)
, and
IlvSDMModel.setObjectProperty(java.lang.Object, java.lang.String, java.lang.Object)
) must be implemented.
This method calls the parse(org.xml.sax.InputSource)
method
that reads the XML input source using a SAX parser.
model
- The SDM model to which the objects read from the XML file will be added.in
- The input stream to read from.insert
- Must be true
if the objects are
read into a nonempty model.properties
- If non-null
, the processing
instruction <?sdm prop1="value1" prop2="value2"?>
is parsed
(if present), and the properties that it contains are stored in
the Hashtable
parameter.insert
is true
, this
method returns an enumeration of the objects read from the XML stream.
Otherwise, the method returns null
.IlvNotAnSDMDocumentException
- if the root element of the XML document
does not have the tag specified by setRootElementTag(java.lang.String)
, and if
setCheckingRootElementTag(true)
was called.IlvSDMException
- if the model is not editable, or if an
error occurred while reading or parsing the XML file.IOException
- if an I/O error occurred.readXML(ilog.views.sdm.IlvSDMModel,java.lang.String,boolean,java.util.Hashtable)
,
readXML(ilog.views.sdm.IlvSDMModel,java.io.Reader,boolean,java.util.Hashtable)
,
readDOM(ilog.views.sdm.IlvSDMModel,org.w3c.dom.Document,boolean,java.util.Hashtable)
public Enumeration<?> readXML(IlvSDMModel model, Reader reader, boolean insert, Hashtable properties) throws IlvSDMException, IOException
IlvSDMModel.isEditable()
method must
return true
,
and the editing methods (IlvSDMModel.addObject(java.lang.Object, java.lang.Object, java.lang.Object)
,
IlvSDMModel.removeObject(java.lang.Object)
, and
IlvSDMModel.setObjectProperty(java.lang.Object, java.lang.String, java.lang.Object)
) must be implemented.
This method calls the parse(org.xml.sax.InputSource)
method
that reads the XML input source using a SAX parser.
model
- The SDM model to which the objects read from the XML file will be added.reader
- The reader to read from.insert
- Must be true
if the objects are
read into a nonempty model.properties
- If non-null
, the processing
instruction <?sdm prop1="value1" prop2="value2"?>
is parsed
(if present), and the properties that it contains are stored in
the Hashtable
parameter.insert
is true
, this
method returns an enumeration of the objects read from the XML stream.
Otherwise, the method returns null
.IlvNotAnSDMDocumentException
- if the root element of the XML document
does not have the tag specified by setRootElementTag(java.lang.String)
, and if
setCheckingRootElementTag(true)
was called.IlvSDMException
- if the model is not editable, or if an
error occurred while reading or parsing the XML file.IOException
- if an I/O error occurred.readXML(ilog.views.sdm.IlvSDMModel,java.lang.String,boolean,java.util.Hashtable)
,
readXML(ilog.views.sdm.IlvSDMModel,java.io.InputStream,boolean,java.util.Hashtable)
,
readDOM(ilog.views.sdm.IlvSDMModel,org.w3c.dom.Document,boolean,java.util.Hashtable)
public Enumeration readDOM(IlvSDMModel model, Document document, boolean insert, Hashtable properties) throws IlvSDMException, IOException
IlvSDMModel.isEditable()
method must
return true
,
and the editing methods (IlvSDMModel.addObject(java.lang.Object, java.lang.Object, java.lang.Object)
,
IlvSDMModel.removeObject(java.lang.Object)
, and
IlvSDMModel.setObjectProperty(java.lang.Object, java.lang.String, java.lang.Object)
) must be implemented.
This method calls the parse(org.w3c.dom.Document)
method
that builds the SDM model from a DOM document.
model
- The SDM model in which the objects read from the XML file will be added.document
- The DOM document from which the SDM model will be built.insert
- Must be true
if the objects are
read into a non-empty model.properties
- If non-null
, the processing
instruction <?sdm prop1="value1" prop2="value2"?>
is parsed
(if present), and the properties that it contains are stored in
this Hashtable
parameter.insert
is true
, this
method returns an enumeration of the objects read from the XML source.
Otherwise, the method returns null
.IlvNotAnSDMDocumentException
- if the root element of the XML document
does not have the tag specified by setRootElementTag(java.lang.String)
, and if
setCheckingRootElementTag(true)
was called.IlvSDMException
- if the model is not editable, or if an
error occurred while reading or parsing the XML file.IOException
- if an I/O error occurred.readXML(ilog.views.sdm.IlvSDMModel,java.io.InputStream,boolean,java.util.Hashtable)
public IlvMModel getMetadata()
null
if no metadata was present in the
last XML file.public void setMetadata(IlvMModel model)
writeXML
.protected IlvSDMModel getModel()
This method can be used to query information from the data model
while implementing a subclass of IlvXMLConnector
.
Note that, while reading an XML file, you should not call directly
the methods of the data model to modify it.
Instead, you should call the following methods of
IlvXMLConnector
, which ensure the consistency
of the model:
createNode
,
createLink
,
addObject
,
setID
,
setFrom
,
setTo
, and
setProperty
.
public void setEngine(IlvSDMEngine engine)
engine
- The calling engine.public IlvSDMEngine getEngine()
setEngine(ilog.views.sdm.IlvSDMEngine)
protected Object createNode(String tag)
tag
- The tag of the new node.protected Object createLink(String tag)
tag
- The tag of the new link.protected void addObject(Object object, Object parent)
object
- The object to add.parent
- The parent of the object (can be null
).protected String setID(Object obj, String id)
obj
- The data object whose identifier must be set.id
- The new ID read from the XML source.id
parameter if this
identifier was already used.protected void setFrom(Object link, Object from)
link
- The link object.from
- The source node.protected void setTo(Object link, Object to)
link
- The link object.to
- The destination node.protected void setFrom(Object link, String id)
link
- The link object.id
- The identifier of the source node.protected void setTo(Object link, String id)
link
- The link object.id
- The identifier of the destination node.protected void setProperty(Object object, String name, Object value)
Note: This method is used at read time to set the model objects properties. Override it if you need to make additional computations linking property values with external data.
object
- The data object.name
- The property name.value
- The property value.protected void parse(InputSource in) throws IlvSDMException, IOException
readXML
.
This method creates a SAX parser and calls initXMLReader
to initialize the content handler.
in
- The input source to parse.IlvSDMException
IOException
@Deprecated protected void initParser(Parser parser)
initXMLReader(org.xml.sax.XMLReader)
instead.parse(org.xml.sax.InputSource)
to initialize
the SAX parser.
This method is still present for compatibility reasons in JViews 5.0,
but you should override the new method initXMLReader(org.xml.sax.XMLReader)
instead.
parser
- The SAX1 parser.protected void initXMLReader(XMLReader reader)
parse(org.xml.sax.InputSource)
to initialize
the SAX2 XML reader. The default implementation sets the
parser's content handler to a default handler that interprets
the XML format described in the class description.
You can override this method to provide your own content handler
if you want to accept a different XML format.reader
- The SAX2 XML reader.protected void addForwardRef(Object link, String id, boolean to)
resolveForwardRefs(java.lang.Object, java.lang.String)
.link
- The link whose source or destination
node has not yet been read.id
- The identifier of the source or destination node.to
- false
if the id
specifies the source node of the link, or true
if it
specifies the destination node.protected void resolveForwardRefs(Object node, String id)
node
- The node that has just been read.id
- The identifier of the node.protected void parse(Document document) throws IlvSDMException
readDOM
.
document
- The document to parse.IlvSDMException
public void writeXML(IlvSDMModel model, OutputStream out, Enumeration objects, Hashtable properties) throws IOException
This method calls buildDOM
to create a copy of the
SDM data model as a DOM tree, and then the DOM tree is saved to
the output stream.
model
- The SDM model that will be written to the XML stream.out
- The output stream to write to.objects
- An enumeration returning the objects to save.
If null
, all the objects of
the model are saved.properties
- If non-null
, the properties
contained in this Hashtable
are saved in the XML output as a processing
instruction of the form <?sdm prop1="value1" prop2="value2"?>
.
IOException
- if an I/O error occurred.writeDOM(ilog.views.sdm.IlvSDMModel,org.w3c.dom.Document,java.util.Enumeration,java.util.Hashtable)
,
writeXML(ilog.views.sdm.IlvSDMModel,java.io.Writer,java.util.Enumeration,java.util.Hashtable)
public void writeXML(IlvSDMModel model, Writer writer, Enumeration objects, Hashtable properties) throws IOException
This method calls buildDOM
to create a copy of the
SDM data model as a DOM tree, and then the DOM tree is saved to
the output stream.
model
- The SDM model that will be written to the XML writer.writer
- The Writer
to write to.objects
- An enumeration returning the objects to save.
If null
, all the objects of
the model are saved.properties
- If non-null
, the properties
contained in this Hashtable
are saved in the XML output as a processing
instruction of the form <?sdm prop1="value1" prop2="value2"?>
.
IOException
- if an I/O error occurred.writeDOM(ilog.views.sdm.IlvSDMModel,org.w3c.dom.Document,java.util.Enumeration,java.util.Hashtable)
,
writeXML(ilog.views.sdm.IlvSDMModel,java.io.OutputStream,java.util.Enumeration,java.util.Hashtable)
public void writeDOM(IlvSDMModel model, Document document, Enumeration objects, Hashtable properties)
This method calls buildDOM
to create a copy of the
SDM data model in the specified DOM document.
model
- The SDM model that will be written to the XML stream.document
- The DOM document to fill with the SDM data.objects
- An enumeration returning the objects to save.
If null
, all the objects of
the model are saved.properties
- If non-null
, the properties
contained in this Hashtable
are saved in the XML output as a processing
instruction of the form <?sdm prop1="value1" prop2="value2"?>
.writeXML(ilog.views.sdm.IlvSDMModel,java.io.OutputStream,java.util.Enumeration,java.util.Hashtable)
,
writeXML(ilog.views.sdm.IlvSDMModel,java.io.Writer,java.util.Enumeration,java.util.Hashtable)
protected void buildDOM(Document document, IlvSDMModel model, Enumeration objects)
writeXML
to build a DOM tree that represents the specified SDM data model.
The default implementation builds a DOM tree with the structure described in the class description. You can override this method to save the data model in a different format.
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.setSavingDTD(boolean)
,
setPublicDTDId(java.lang.String)
,
setSystemDTDId(java.lang.String)
protected void parseProcessingInstruction(String data)
"sdm"
.
The data of the processing instruction is assumed to be of the
form <?sdm prop1="value1" prop2="value2"?>
.
This method fills the Hashtable
passed as the properties
parameter of the readXML
method with the key/value
pairs (prop1/value1, prop2/value2, ...) contained in the processing
instruction.
The instruction incremental="true"
is handled directly
by the XML connector, and is equivalent to calling setIncremental(boolean)
.
When the XML connector reads an XML file containing the processing
instruction:
<?sdm incremental="true"?>it will read the file in incremental mode, and restore the original mode when the file has been parsed.
data
- The data string of the processing instruction.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.