com.devsphere.mapping
Class XMLUtils

java.lang.Object
  |
  +--com.devsphere.mapping.XMLUtils

public class XMLUtils
extends java.lang.Object

Utility class that implements XML related operations.

See Also:
CharacterEncoding, AbstractLogger

Method Summary
static void beanToXML(java.lang.Object bean, java.util.Hashtable errorTable, java.io.OutputStream output)
          Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding.
static void beanToXML(java.lang.Object bean, java.util.Hashtable errorTable, java.io.OutputStream output, AbstractLogger logger)
          Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding.
static void beanToXML(java.lang.Object bean, java.util.Hashtable errorTable, java.io.OutputStream output, AbstractLogger logger, int encoding)
          Saves the values of the properties of a bean to an output stream as XML.
static void beanToXML(java.lang.Object bean, java.util.Hashtable errorTable, java.io.OutputStream output, AbstractLogger logger, int encoding, java.util.Locale locale)
          Saves the values of the properties of a bean to an output stream as XML.
static void beanToXML(java.lang.Object bean, java.util.Hashtable errorTable, java.io.OutputStream output, AbstractLogger logger, java.util.Locale locale)
          Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding.
static java.util.Hashtable xmlToBean(java.io.InputStream input, java.lang.Object bean)
          Fills the properties of a bean with data encoded in an XML document.
static java.util.Hashtable xmlToBean(java.io.InputStream input, java.lang.Object bean, AbstractLogger logger)
          Fills the properties of a bean with data encoded in an XML document.
static java.util.Hashtable xmlToBean(java.io.InputStream input, java.lang.Object bean, AbstractLogger logger, int encoding)
          Fills the properties of a bean with data encoded in an XML document.
static java.util.Hashtable xmlToBean(java.io.InputStream input, java.lang.Object bean, AbstractLogger logger, int encoding, java.util.Locale locale)
          Fills the properties of a bean with data encoded in an XML document.
static java.util.Hashtable xmlToBean(java.io.InputStream input, java.lang.Object bean, AbstractLogger logger, java.util.Locale locale)
          Fills the properties of a bean with data encoded in an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

xmlToBean

public static java.util.Hashtable xmlToBean(java.io.InputStream input,
                                            java.lang.Object bean)
                                     throws java.io.IOException
Fills the properties of a bean with data encoded in an XML document. All errors that occur during the mapping process are stored in a hashtable.
Parameters:
input - the input stream that is used to read the XML document.
bean - the bean instance whose properties must be filled.
Returns:
an hashtable containing the application and user errors or null if no error occurred.
Throws:
NullPointerException - if input is null or bean is null.
InternalError - if the XML parser isn't found.
java.io.IOException - if an I/O error or XML parsing error occurs.

xmlToBean

public static java.util.Hashtable xmlToBean(java.io.InputStream input,
                                            java.lang.Object bean,
                                            AbstractLogger logger)
                                     throws java.io.IOException
Fills the properties of a bean with data encoded in an XML document. All errors that occur during the mapping process are stored in a hashtable.
Parameters:
input - the input stream that is used to read the XML document.
bean - the bean instance whose properties must be filled.
logger - logging mechanism for application errors.
Returns:
an hashtable containing the application and user errors or null if no error occurred.
Throws:
NullPointerException - if input is null or bean is null.
InternalError - if the XML parser isn't found.
java.io.IOException - if an I/O error or XML parsing error occurs.

xmlToBean

public static java.util.Hashtable xmlToBean(java.io.InputStream input,
                                            java.lang.Object bean,
                                            AbstractLogger logger,
                                            int encoding)
                                     throws java.io.IOException
Fills the properties of a bean with data encoded in an XML document. All errors that occur during the mapping process are stored in a hashtable.
Parameters:
input - the input stream that is used to read the XML document.
bean - the bean instance whose properties must be filled.
logger - logging mechanism for application errors.
encoding - the character encoding. See the constants declared by CharacterEncoding.
Returns:
an hashtable containing the application and user errors or null if no error occurred.
Throws:
NullPointerException - if input is null or bean is null.
java.lang.IllegalArgumentException - if encoding has an invalid value.
InternalError - if the XML parser isn't found.
java.io.IOException - if an I/O error or XML parsing error occurs.

xmlToBean

public static java.util.Hashtable xmlToBean(java.io.InputStream input,
                                            java.lang.Object bean,
                                            AbstractLogger logger,
                                            java.util.Locale locale)
                                     throws java.io.IOException
Fills the properties of a bean with data encoded in an XML document. All errors that occur during the mapping process are stored in a hashtable.
Parameters:
input - the input stream that is used to read the XML document.
bean - the bean instance whose properties must be filled.
logger - logging mechanism for application errors.
locale - internationalization support parameter.
Returns:
an hashtable containing the application and user errors or null if no error occurred.
Throws:
NullPointerException - if input is null or bean is null.
InternalError - if the XML parser isn't found.
java.io.IOException - if an I/O error or XML parsing error occurs.

xmlToBean

public static java.util.Hashtable xmlToBean(java.io.InputStream input,
                                            java.lang.Object bean,
                                            AbstractLogger logger,
                                            int encoding,
                                            java.util.Locale locale)
                                     throws java.io.IOException
Fills the properties of a bean with data encoded in an XML document. All errors that occur during the mapping process are stored in a hashtable.
Parameters:
input - the input stream that is used to read the XML document.
bean - the bean instance whose properties must be filled.
logger - logging mechanism for application errors.
encoding - the character encoding. See the constants declared by CharacterEncoding.
locale - internationalization support parameter.
Returns:
an hashtable containing the application and user errors or null if no error occurred.
Throws:
NullPointerException - if input is null or bean is null.
java.lang.IllegalArgumentException - if encoding has an invalid value.
InternalError - if the XML parser isn't found.
java.io.IOException - if an I/O error or XML parsing error occurs.

beanToXML

public static void beanToXML(java.lang.Object bean,
                             java.util.Hashtable errorTable,
                             java.io.OutputStream output)
                      throws java.io.IOException
Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding. The errorTable parameter may be null or it must be a hashtable returned by one of the mapping methods of the framework.
Parameters:
bean - the bean instance whose properties must be saved.
errorTable - hashtable containing mapping errors.
output - the output stream used to save the bean's data.
Throws:
NullPointerException - if bean is null or output is null.
java.lang.IllegalArgumentException - if errorTable wasn't created by this framework or if encoding has an invalid value.
java.io.IOException - if an I/O error occurs.

beanToXML

public static void beanToXML(java.lang.Object bean,
                             java.util.Hashtable errorTable,
                             java.io.OutputStream output,
                             AbstractLogger logger)
                      throws java.io.IOException
Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding. The errorTable parameter may be null or it must be a hashtable returned by one of the mapping methods of the framework.
Parameters:
bean - the bean instance whose properties must be saved.
errorTable - hashtable containing mapping errors.
output - the output stream used to save the bean's data.
logger - logging mechanism for application errors.
Throws:
NullPointerException - if bean is null or output is null.
java.lang.IllegalArgumentException - if errorTable wasn't created by this framework or if encoding has an invalid value.
java.io.IOException - if an I/O error occurs.

beanToXML

public static void beanToXML(java.lang.Object bean,
                             java.util.Hashtable errorTable,
                             java.io.OutputStream output,
                             AbstractLogger logger,
                             int encoding)
                      throws java.io.IOException
Saves the values of the properties of a bean to an output stream as XML. The errorTable parameter may be null or it must be a hashtable returned by one of the mapping methods of the framework.
Parameters:
bean - the bean instance whose properties must be saved.
errorTable - hashtable containing mapping errors.
output - the output stream used to save the bean's data.
logger - logging mechanism for application errors.
encoding - the character encoding. See the constants declared by CharacterEncoding.
Throws:
NullPointerException - if bean is null or output is null.
java.lang.IllegalArgumentException - if errorTable wasn't created by this framework or if encoding has an invalid value.
java.io.IOException - if an I/O error occurs.

beanToXML

public static void beanToXML(java.lang.Object bean,
                             java.util.Hashtable errorTable,
                             java.io.OutputStream output,
                             AbstractLogger logger,
                             java.util.Locale locale)
                      throws java.io.IOException
Saves the values of the properties of a bean to an output stream as XML using the UTF-8 character encoding. The errorTable parameter may be null or it must be a hashtable returned by one of the mapping methods of the framework.
Parameters:
bean - the bean instance whose properties must be saved.
errorTable - hashtable containing mapping errors.
output - the output stream used to save the bean's data.
logger - logging mechanism for application errors.
locale - internationalization support parameter.
Throws:
NullPointerException - if bean is null or output is null.
java.lang.IllegalArgumentException - if errorTable wasn't created by this framework.
java.io.IOException - if an I/O error occurs.

beanToXML

public static void beanToXML(java.lang.Object bean,
                             java.util.Hashtable errorTable,
                             java.io.OutputStream output,
                             AbstractLogger logger,
                             int encoding,
                             java.util.Locale locale)
                      throws java.io.IOException
Saves the values of the properties of a bean to an output stream as XML. The errorTable parameter may be null or it must be a hashtable returned by one of the mapping methods of the framework.
Parameters:
bean - the bean instance whose properties must be saved.
errorTable - hashtable containing mapping errors.
output - the output stream used to save the bean's data.
logger - logging mechanism for application errors.
encoding - the character encoding. See the constants declared by CharacterEncoding.
locale - internationalization support parameter.
Throws:
NullPointerException - if bean is null or output is null.
java.lang.IllegalArgumentException - if errorTable wasn't created by this framework or if encoding has an invalid value.
java.io.IOException - if an I/O error occurs.