Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.view.servlet.xml
Class ModelToXML  view ModelToXML download ModelToXML.java

java.lang.Object
  extended byorg.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.5 $ $Date: 2002/01/26 09:46:20 $

Field Summary
protected static java.lang.String CDATA_TYPE
           
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
           
protected static java.lang.String ID_ATTRIBUTE
           
protected  org.xml.sax.helpers.AttributesImpl idAttributes
           
protected static java.lang.String IDREF_ATTRIBUTE
           
protected  org.xml.sax.helpers.AttributesImpl idrefAttributes
           
protected  org.xml.sax.helpers.AttributesImpl indexAttributes
           
private static org.apache.commons.logging.Log LOG
           
protected static java.lang.String MODEL_ELEMENT
          Element to contain a model object.
protected static java.lang.String PATH_ATTRIBUTE
           
protected  org.xml.sax.helpers.AttributesImpl pathAttributes
           
protected  org.xml.sax.helpers.AttributesImpl pathIndexAttributes
           
 
Constructor Summary
ModelToXML()
           
 
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, IdRefMap inIdRefMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

ID_ATTRIBUTE

protected static final java.lang.String ID_ATTRIBUTE
See Also:
Constant Field Values

IDREF_ATTRIBUTE

protected static final java.lang.String IDREF_ATTRIBUTE
See Also:
Constant Field Values

CDATA_TYPE

protected static final java.lang.String CDATA_TYPE
See Also:
Constant Field Values

PATH_ATTRIBUTE

protected static final java.lang.String PATH_ATTRIBUTE
See Also:
Constant Field Values

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

idrefAttributes

protected org.xml.sax.helpers.AttributesImpl idrefAttributes

pathIndexAttributes

protected org.xml.sax.helpers.AttributesImpl pathIndexAttributes

indexAttributes

protected org.xml.sax.helpers.AttributesImpl indexAttributes

pathAttributes

protected org.xml.sax.helpers.AttributesImpl pathAttributes

EMPTY_ATTRIBUTES

protected static final org.xml.sax.Attributes EMPTY_ATTRIBUTES
Constructor Detail

ModelToXML

public ModelToXML()
Method Detail

init

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


modelToXML

public void modelToXML(java.lang.Object inModel,
                       org.xml.sax.ContentHandler inContentHandler,
                       PropertyIDGenerator inIDGenerator)
                throws java.lang.Exception

propertiesToXML

protected void propertiesToXML(java.lang.Object inModel,
                               org.xml.sax.ContentHandler inContentHandler,
                               PropertyIDGenerator inIDGenerator,
                               IdRefMap inIdRefMap)
                        throws java.lang.Exception