org.scopemvc.view.servlet.xml
Class ModelToXML

java.lang.Object
  |
  +--org.scopemvc.view.servlet.xml.ModelToXML

public class ModelToXML
extends java.lang.Object

Converts a model into an XML document (as SAX events driving a ContentHandler). Uses a PropertyIDGenerator to create "path" attributes for all elements, and "id" attributes for model elements.

Handles circular references using the "ID" and "IDREF" pattern.

 (data id='_root')
     (name path='name')Steve(/name)
     (pets path='pets')
         (element index='0' path='pets.0')
             (data id='pets.0')
                 (name path='pets.0.name')Trevor(/name)
             (/data)
         (/element)
     (/pets)
 (/data)
 

Version:
$Revision: 1.7 $ $Date: 2002/09/05 15:41:45 $
Author:
Steve Meyfroidt

Field Summary
protected static java.lang.String CDATA_TYPE
          TODO: describe of the Field
protected static java.lang.String COLLECTION_ELEMENT
          Element to contain contents of a collection model.
protected static java.lang.String COLLECTION_INDEX_ATTRIBUTE
          Attribute to index the contents of a collection model.
protected static org.xml.sax.Attributes EMPTY_ATTRIBUTES
          TODO: describe of the Field
protected static java.lang.String ID_ATTRIBUTE
          TODO: describe of the Field
protected  org.xml.sax.helpers.AttributesImpl idAttributes
          TODO: describe of the Field
protected static java.lang.String IDREF_ATTRIBUTE
          TODO: describe of the Field
protected  org.xml.sax.helpers.AttributesImpl idrefAttributes
          TODO: describe of the Field
protected  org.xml.sax.helpers.AttributesImpl indexAttributes
          TODO: describe of the Field
protected static java.lang.String MODEL_ELEMENT
          Element to contain a model object.
protected static java.lang.String PATH_ATTRIBUTE
          TODO: describe of the Field
protected  org.xml.sax.helpers.AttributesImpl pathAttributes
          TODO: describe of the Field
protected  org.xml.sax.helpers.AttributesImpl pathIndexAttributes
          TODO: describe of the Field
 
Constructor Summary
ModelToXML()
          Constructor for the ModelToXML object
 
Method Summary
protected  void init()
          Initialise the Attributes that are reused during SAX generation.
 void modelToXML(java.lang.Object inModel, org.xml.sax.ContentHandler inContentHandler, PropertyIDGenerator inIDGenerator)
           
protected  void propertiesToXML(java.lang.Object inModel, org.xml.sax.ContentHandler inContentHandler, PropertyIDGenerator inIDGenerator, org.scopemvc.view.servlet.xml.IdRefMap inIdRefMap)
          TODO: document the method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_ATTRIBUTE

protected static final java.lang.String ID_ATTRIBUTE
TODO: describe of the Field

See Also:
Constant Field Values

IDREF_ATTRIBUTE

protected static final java.lang.String IDREF_ATTRIBUTE
TODO: describe of the Field

See Also:
Constant Field Values

CDATA_TYPE

protected static final java.lang.String CDATA_TYPE
TODO: describe of the Field

See Also:
Constant Field Values

PATH_ATTRIBUTE

protected static final java.lang.String PATH_ATTRIBUTE
TODO: describe of the Field

See Also:
Constant Field Values

EMPTY_ATTRIBUTES

protected static final org.xml.sax.Attributes EMPTY_ATTRIBUTES
TODO: describe of the Field


COLLECTION_ELEMENT

protected static java.lang.String COLLECTION_ELEMENT
Element to contain contents of a collection model.


COLLECTION_INDEX_ATTRIBUTE

protected static java.lang.String COLLECTION_INDEX_ATTRIBUTE
Attribute to index the contents of a collection model.


MODEL_ELEMENT

protected static java.lang.String MODEL_ELEMENT
Element to contain a model object.


idAttributes

protected org.xml.sax.helpers.AttributesImpl idAttributes
TODO: describe of the Field


idrefAttributes

protected org.xml.sax.helpers.AttributesImpl idrefAttributes
TODO: describe of the Field


pathIndexAttributes

protected org.xml.sax.helpers.AttributesImpl pathIndexAttributes
TODO: describe of the Field


indexAttributes

protected org.xml.sax.helpers.AttributesImpl indexAttributes
TODO: describe of the Field


pathAttributes

protected org.xml.sax.helpers.AttributesImpl pathAttributes
TODO: describe of the Field

Constructor Detail

ModelToXML

public ModelToXML()
Constructor for the ModelToXML object

Method Detail

modelToXML

public void modelToXML(java.lang.Object inModel,
                       org.xml.sax.ContentHandler inContentHandler,
                       PropertyIDGenerator inIDGenerator)
                throws java.lang.Exception
Parameters:
inContentHandler - Drive this ContentHandler with the Model's SAX events.
inModel - Model object to write. null generates no SAX.
inIDGenerator - TODO: Describe the Parameter
Throws:
java.lang.Exception - TODO: Describe the Exception

init

protected void init()
Initialise the Attributes that are reused during SAX generation.


propertiesToXML

protected void propertiesToXML(java.lang.Object inModel,
                               org.xml.sax.ContentHandler inContentHandler,
                               PropertyIDGenerator inIDGenerator,
                               org.scopemvc.view.servlet.xml.IdRefMap inIdRefMap)
                        throws java.lang.Exception
TODO: document the method

Parameters:
inModel - TODO: Describe the Parameter
inContentHandler - TODO: Describe the Parameter
inIDGenerator - TODO: Describe the Parameter
inIdRefMap - TODO: Describe the Parameter
Throws:
java.lang.Exception - TODO: Describe the Exception


Copyright © 2000-2002 The Scope Team. All Rights Reserved.