com.ibm.sensorevent.model.converter
Class XMLConverter

java.lang.Object
  extended by com.ibm.sensorevent.model.generic.converter.GenericConverter
      extended by com.ibm.sensorevent.model.converter.Converter
          extended by com.ibm.sensorevent.model.converter.XMLConverter
All Implemented Interfaces:
IConverter, IGenericConverter, java.io.Serializable

public class XMLConverter
extends Converter
implements IConverter

The XMLConverter class converts ISensorEvents and XML strings to other formats. The XML string is in the form of the XML representing a CommonBaseEvent. Specifically, use the XMLConverter class to convert:

XMLConverter creates the XML string without using CommonBaseEvent (CBE) objects.

Event XML created by XMLConverter removes the attribute value limit of 1024 characters. XML with an attribute value length greater than 1024 characters may not be consumable by other applications that adhere to the strict 1024 character limit. To create CBE-conforming event XML, use CBEConverter.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
           
static java.lang.String XML_SITUATION_TYPE
          The CommonBaseEvent situation type used in all XML strings
 
Constructor Summary
XMLConverter()
          Constructs an XMLConverter
 
Method Summary
 javax.xml.parsers.SAXParser createSAXParser()
          Create an instance of a SAXParser to use to parse XML events.
static IGenericConverter getInstance()
          Factory method to create an XMLConverter instance
 ISensorEvent toIBMSensorEvent(javax.xml.parsers.SAXParser sp, java.lang.String xml)
          Converts an XML string in CommonBaseEvent XML format to an ISensorEvent
 ISensorEvent toIBMSensorEvent(java.lang.String xml)
          Converts an XML string in CommonBaseEvent XML format to an ISensorEvent
 java.lang.String toXMLString(ISensorEvent event)
          Converts an ISensorEvent to an XML string in CommonBaseEvent XML format
 
Methods inherited from class com.ibm.sensorevent.model.generic.converter.GenericConverter
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

XML_SITUATION_TYPE

public static java.lang.String XML_SITUATION_TYPE
The CommonBaseEvent situation type used in all XML strings

Constructor Detail

XMLConverter

public XMLConverter()
Constructs an XMLConverter

Method Detail

getInstance

public static IGenericConverter getInstance()
Factory method to create an XMLConverter instance


toIBMSensorEvent

public ISensorEvent toIBMSensorEvent(java.lang.String xml)
                              throws SensorEventException
Converts an XML string in CommonBaseEvent XML format to an ISensorEvent

Specified by:
toIBMSensorEvent in interface IConverter
Parameters:
xml - - the XML string to convert
Throws:
SensorEventException

toIBMSensorEvent

public ISensorEvent toIBMSensorEvent(javax.xml.parsers.SAXParser sp,
                                     java.lang.String xml)
                              throws SensorEventException
Converts an XML string in CommonBaseEvent XML format to an ISensorEvent

Parameters:
sp - - Instance of the SAXParser to use.
xml - - the XML string to convert
Throws:
SensorEventException

createSAXParser

public javax.xml.parsers.SAXParser createSAXParser()
                                            throws ConverterException
Create an instance of a SAXParser to use to parse XML events.

Returns:
SAXParser that is configured to parse events.
Throws:
ConverterException

toXMLString

public java.lang.String toXMLString(ISensorEvent event)
                             throws SensorEventException
Converts an ISensorEvent to an XML string in CommonBaseEvent XML format

Specified by:
toXMLString in interface IConverter
Parameters:
event - - the ISensorEvent to convert
Throws:
SensorEventException


Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.