com.SecurePlay.SPUxml
Class SPUxml

java.lang.Object
  extended byorg.xml.sax.HandlerBase
      extended bycom.SecurePlay.SPUxml.SPUxml
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SPUxml
extends org.xml.sax.HandlerBase

This utility class is used to serialize SPAbstractMessageClasses to an XML Message document, and deserialize an XML Message document to a SPMessageClass

Author:
IT GlobalSecure
See Also:
SecurePlay License Information, XML Message DTD Information
 

Constructor Summary
SPUxml()
           
 
Method Summary
 void characters(char[] buffer, int start, int length)
          Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer
 void endElement(java.lang.String name)
          Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters the end of an element, it calls this method
 void error(org.xml.sax.SAXParseException exception)
          This method is called when errors occur
 void fatalError(org.xml.sax.SAXParseException exception)
          This method is called when non-recoverable errors occur.
static void resetmess()
           
static java.lang.String[] serializeMessages(SPMessageClass[] messages)
          This method serializes only multiple SPMessageClass (es)
static java.lang.String[] serializeOneMessage(SPMessageClass mess)
          This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD (called by the above wrapper methods multiple to serialize multiple or just one)
 void startElement(java.lang.String name, org.xml.sax.AttributeList attributes)
          Overridden Method from org.xml.sax.HandlerBase Class Every time the parser encounters the beginning of a new element, it calls this method, which resets the string buffer
 void warning(org.xml.sax.SAXParseException exception)
          This method is called when warnings occur
static java.lang.String[] XMLaddDTD()
          This method returns the DTD for the XML message document.
static SPMessageClass[] XMLdeserializeBufferedReader(java.io.BufferedReader buffreader, boolean DTDcheck)
          This method deserializes XML documents into SPABstractMessageClasses from a BufferedReader.
static SPMessageClass[] XMLdeserializeFile(java.lang.String filename)
          This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name.
static SPMessageClass[] XMLdeserializeFile(java.lang.String filename, boolean DTDcheck)
          This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name, and gives you the option of checking the DTD.
static SPMessageClass[] XMLdeserializeString(java.lang.String str)
          This method deserializes an XML document to SPAbstractMessageClasses, from a string.
static SPMessageClass[] XMLdeserializeString(java.lang.String str, boolean DTDcheck)
          This method deserializes an XML document to SPAbstractMessageClasses, from a string, and gives you the option of checking the DTD.
static java.lang.String[] XMLserialize(SPMessageClass mess)
          This method serializes only one SPMessageClass into an XML document and does not include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass[] messages)
          This method serializes only multiple SPMessageClass into an XML document and does not include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass[] messages, boolean includeDTD)
          This method serializes only multiple SPMessageClass into an XML document and gives you the option to include the DTD.
static java.lang.String[] XMLserialize(SPMessageClass mess, boolean includeDTD)
          This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD.
static java.lang.String[] XMLserializefooter()
          This method serializes the message package footer
static java.lang.String[] XMLserializeheader(boolean includeDTD)
          This method serializes the message header with our without the DTD
 
Methods inherited from class org.xml.sax.HandlerBase
endDocument, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPUxml

public SPUxml()
Method Detail

XMLaddDTD

public static java.lang.String[] XMLaddDTD()
This method returns the DTD for the XML message document.

Returns:
xmldtd - String[] - the generated dtd.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass mess)
This method serializes only one SPMessageClass into an XML document and does not include the DTD.

Parameters:
mess - SPMessageClass - the message to be serialized
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass mess,
                                              boolean includeDTD)
This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD.

Parameters:
mess - SPMessageClass - the message to be serialized
includeDTD - boolean - True, includes the DTD; False, does not include the DTD
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass[] messages)
This method serializes only multiple SPMessageClass into an XML document and does not include the DTD.

Parameters:
messages - SPMessageClass[] - the messagees to be serialized
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

XMLserialize

public static java.lang.String[] XMLserialize(SPMessageClass[] messages,
                                              boolean includeDTD)
This method serializes only multiple SPMessageClass into an XML document and gives you the option to include the DTD.

Parameters:
messages - SPMessageClass[] - the messages to be serialized
includeDTD - boolean - True, includes the DTD; False, does not include the DTD
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

serializeOneMessage

public static java.lang.String[] serializeOneMessage(SPMessageClass mess)
This method serializes only one SPMessageClass into an XML document and gives you the option to include the DTD (called by the above wrapper methods multiple to serialize multiple or just one)

Parameters:
mess - SPMessageClass - the message to be serialized
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

XMLdeserializeString

public static SPMessageClass[] XMLdeserializeString(java.lang.String str)
This method deserializes an XML document to SPAbstractMessageClasses, from a string.

Parameters:
str - String - the string that contains the serialized messages.
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from an XML document.

XMLdeserializeFile

public static SPMessageClass[] XMLdeserializeFile(java.lang.String filename)
This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name.

Parameters:
filename - String - name of the file to be deserialized.
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that has been derserialized from an XML document.

XMLdeserializeString

public static SPMessageClass[] XMLdeserializeString(java.lang.String str,
                                                    boolean DTDcheck)
This method deserializes an XML document to SPAbstractMessageClasses, from a string, and gives you the option of checking the DTD.

Parameters:
str - String - the string that contains the serialized messages.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from an XML document.

XMLdeserializeFile

public static SPMessageClass[] XMLdeserializeFile(java.lang.String filename,
                                                  boolean DTDcheck)
This method deserializes an XML document to SPAbstractMessageClasses, using the specified file name, and gives you the option of checking the DTD.

Parameters:
filename - String - name of the file to be deserialized.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess[] - SPMessageClass - the SPAbstractMessageClasses that has been derserialized from an XML document.

XMLdeserializeBufferedReader

public static SPMessageClass[] XMLdeserializeBufferedReader(java.io.BufferedReader buffreader,
                                                            boolean DTDcheck)
This method deserializes XML documents into SPABstractMessageClasses from a BufferedReader.

Parameters:
buffreader - BufferedReader - the reader from which the XML documents are buffered in.
DTDcheck - boolean - True, check the DTD; False, does not check the DTD
Returns:
mess - SPMessageClass - the SPAbstractMessageClasses that have been derserialized from XML document buffer.

characters

public void characters(char[] buffer,
                       int start,
                       int length)
Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters plain text (not XML elements), it calls this method, which accumulates them in a string buffer


startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList attributes)
Overridden Method from org.xml.sax.HandlerBase Class Every time the parser encounters the beginning of a new element, it calls this method, which resets the string buffer


endElement

public void endElement(java.lang.String name)
Overridden Method from org.xml.sax.HandlerBase Class When the parser encounters the end of an element, it calls this method


warning

public void warning(org.xml.sax.SAXParseException exception)
This method is called when warnings occur


error

public void error(org.xml.sax.SAXParseException exception)
This method is called when errors occur


fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
This method is called when non-recoverable errors occur.

Throws:
org.xml.sax.SAXException

resetmess

public static void resetmess()

XMLserializeheader

public static java.lang.String[] XMLserializeheader(boolean includeDTD)
This method serializes the message header with our without the DTD

Parameters:
includeDTD - - boolean indicator whether to include the DTD.
Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.

serializeMessages

public static java.lang.String[] serializeMessages(SPMessageClass[] messages)
This method serializes only multiple SPMessageClass (es)

Parameters:
messages - SPMessageClass[] - the messages to be serialized
Returns:
serializedXML[] - String[] - the serialized Messages in a XML format in a String array.

XMLserializefooter

public static java.lang.String[] XMLserializefooter()
This method serializes the message package footer

Returns:
serializedXML[] - String[] - the serialized Message in a XML format in a String array.