com.oroad.stxx.xform
Interface XMLForm

All Known Implementing Classes:
AbstractXMLForm, DOMForm, JDOMForm

public interface XMLForm

A form that uses XML to store information. Supports multi-phase validation and serialization. By using xml as the model and separating out the validation, xml forms can be used outside the Struts framework, ie in a SOAP web services environment simultaneously.

Author:
Don Brown

Method Summary
 org.xmlform.Form getForm()
          Gets the underlying XMLForm.org form
 java.lang.String getFormPath()
          Gets the form path
 java.lang.String getName()
          Gets the name of the form
 java.lang.String getPhase()
          Gets the validation phase
 java.lang.String getSchemaNS()
          Gets the schema namespace
 java.lang.String getValue(java.lang.String xpath)
          Gets the value at the xpath path
 java.lang.String getValue(java.lang.String xpath, java.lang.String def)
          Gets the value at the xpath path
 boolean isInitialized()
          Determines if the form is initializes or not
 boolean isViewstateEnabled()
          Gets the validation phase
 void loadState(java.io.InputStream in)
          Loads the XML from the inputstream
 void outputXML(java.io.OutputStream out)
          Serializes the XML
 void prePopulate()
          Called before the form is populated
 void reset()
          Resets the form by loading the default XML if available
 java.lang.String save()
          Saves the form and returns a String status code
 void setDefaultXML(org.w3c.dom.Document doc)
          Sets the default xml
 void setForm(org.xmlform.Form form)
          Sets the underlying XMLForm.org form
 void setFormPath(java.lang.String path)
          Sets the form path
 void setName(java.lang.String name)
          Sets the name of the form
 void setPhase(java.lang.String phase)
          Sets the validation phase
 void setSchema(java.io.InputStream schema)
          Sets the schema path
 void setSchemaNS(java.lang.String schema)
          Sets the schema namespace
 void setValue(java.lang.String xpath, java.lang.Object val)
          Sets the value at the xpath path
 void setViewstateEnabled(boolean val)
          Sets the validation phase
 void setXML(org.w3c.dom.Document doc)
          Sets the form xml
 java.util.List validate()
          Validate the data and generate violations
 

Method Detail

loadState

public void loadState(java.io.InputStream in)
Loads the XML from the inputstream

Parameters:
in - The inputstream

setDefaultXML

public void setDefaultXML(org.w3c.dom.Document doc)
Sets the default xml

Parameters:
doc - The default XML

setXML

public void setXML(org.w3c.dom.Document doc)
Sets the form xml

Parameters:
doc - The default XML

isInitialized

public boolean isInitialized()
Determines if the form is initializes or not

Returns:
True if initialized

setName

public void setName(java.lang.String name)
Sets the name of the form

Parameters:
name - The new name value

getName

public java.lang.String getName()
Gets the name of the form

Returns:
The name value

setSchema

public void setSchema(java.io.InputStream schema)
Sets the schema path

Parameters:
schema - The new schema path

getSchemaNS

public java.lang.String getSchemaNS()
Gets the schema namespace

Returns:
The schema namespace

setSchemaNS

public void setSchemaNS(java.lang.String schema)
Sets the schema namespace

Parameters:
schema - The new schema namespace

setFormPath

public void setFormPath(java.lang.String path)
Sets the form path

Parameters:
path - The new form path

getFormPath

public java.lang.String getFormPath()
Gets the form path

Returns:
The form value

setForm

public void setForm(org.xmlform.Form form)
Sets the underlying XMLForm.org form

Parameters:
form - The new form value

getForm

public org.xmlform.Form getForm()
Gets the underlying XMLForm.org form

Returns:
The form value

getPhase

public java.lang.String getPhase()
Gets the validation phase

Returns:
The phase value

setPhase

public void setPhase(java.lang.String phase)
Sets the validation phase

Parameters:
phase - The new phase value

isViewstateEnabled

public boolean isViewstateEnabled()
Gets the validation phase

Returns:
The phase value

setViewstateEnabled

public void setViewstateEnabled(boolean val)
Sets the validation phase

Parameters:
val - The new viewstateEnabled value

reset

public void reset()
Resets the form by loading the default XML if available


validate

public java.util.List validate()
Validate the data and generate violations

Returns:
A list of Violations

prePopulate

public void prePopulate()
Called before the form is populated


save

public java.lang.String save()
Saves the form and returns a String status code

Returns:
The status code, null if not implemented

outputXML

public void outputXML(java.io.OutputStream out)
Serializes the XML

Parameters:
out - The outputstream

getValue

public java.lang.String getValue(java.lang.String xpath)
Gets the value at the xpath path

Parameters:
xpath - The xpath path
Returns:
The value

getValue

public java.lang.String getValue(java.lang.String xpath,
                                 java.lang.String def)
Gets the value at the xpath path

Parameters:
xpath - The xpath path
def - The default value
Returns:
The value

setValue

public void setValue(java.lang.String xpath,
                     java.lang.Object val)
Sets the value at the xpath path

Parameters:
xpath - The xpath path
val - The value