com.ibm.rfid.premises.app.entities
Class AbstractXmlObject

java.lang.Object
  extended by com.ibm.rfid.premises.app.entities.AbstractXmlObject
Direct Known Subclasses:
EpcData, FormData, Label, LabelList, LabelPrint, PrintDetails, PrintJob

public abstract class AbstractXmlObject
extends java.lang.Object

This basic abstract class for Xml Bean objects. This abstract class facilitates the converting of a bean class to an XML string (using toXmlString(boolean)) and back (using constructor AbstractXmlObject(String, String).


Field Summary
protected  AttributeTable attributes_
          An AttributeTable
protected  java.lang.String EQ
          'Equals' symbol
protected  java.lang.String GT
          'Greater than' symbol
protected  java.lang.String LT
          'Less than' symbol
protected  java.lang.String QUOTE
          'Double quote' symbol
protected  java.lang.String SLASH
          'Slash' symbol
protected  java.lang.String tagName_
          tagName string
static java.lang.String XML_START
          XML file version and encoding header
 
Constructor Summary
AbstractXmlObject(java.lang.String tagName)
          Basic Constructor - creates an empty AbstractXmlObject
AbstractXmlObject(java.lang.String tagName, java.lang.String xml)
          Constructor - creats an AbstractXMLObject containing the XML representation of the object
 
Method Summary
 java.lang.String getEndTag()
          This returns a String representing the closing tag for an XML element.
protected static org.w3c.dom.NodeList getNodeListFromString(java.lang.String xml, java.lang.String elementName)
          Gets a NodeList of the elements based on tag names
 java.lang.String getStartTag()
          This returns a String representing the opening tag for an XML element.
protected static java.lang.String getStringFromElement(org.w3c.dom.Element e)
          Gets the transformed string from the specified element
abstract  java.lang.String toXmlString(boolean isTop)
          Creates an XML string representation of this AbsstractXMLObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LT

protected final java.lang.String LT
'Less than' symbol

See Also:
Constant Field Values

SLASH

protected final java.lang.String SLASH
'Slash' symbol

See Also:
Constant Field Values

GT

protected final java.lang.String GT
'Greater than' symbol

See Also:
Constant Field Values

EQ

protected final java.lang.String EQ
'Equals' symbol

See Also:
Constant Field Values

QUOTE

protected final java.lang.String QUOTE
'Double quote' symbol

See Also:
Constant Field Values

XML_START

public static java.lang.String XML_START
XML file version and encoding header


tagName_

protected java.lang.String tagName_
tagName string


attributes_

protected AttributeTable attributes_
An AttributeTable

Constructor Detail

AbstractXmlObject

public AbstractXmlObject(java.lang.String tagName)
Basic Constructor - creates an empty AbstractXmlObject

Parameters:
tagName - is the String used to identify this AbstractXmlObject object.

AbstractXmlObject

public AbstractXmlObject(java.lang.String tagName,
                         java.lang.String xml)
Constructor - creats an AbstractXMLObject containing the XML representation of the object

Parameters:
tagName - is the String used to identify this AbstractXmlObject object.
xml - is the String that represents this object in XML format.
Method Detail

getStartTag

public java.lang.String getStartTag()
This returns a String representing the opening tag for an XML element.

Example: <tagName>

Returns:
the start tag for this XML element

getEndTag

public java.lang.String getEndTag()
This returns a String representing the closing tag for an XML element.

Example: </tagName>

Returns:
the closing tag for this XML element

toXmlString

public abstract java.lang.String toXmlString(boolean isTop)
Creates an XML string representation of this AbsstractXMLObject

Parameters:
isTop - decides whether or not the XML_START field is appended to the output of this method. Should be true if this AbstractXmlObject is the root element.
Returns:
an XML String representing this AbstractXmlObject.

getNodeListFromString

protected static org.w3c.dom.NodeList getNodeListFromString(java.lang.String xml,
                                                            java.lang.String elementName)
                                                     throws java.lang.Exception
Gets a NodeList of the elements based on tag names

Parameters:
xml - xml string to parse
elementName - the particular element name
Returns:
a NodeList
Throws:
java.lang.Exception

getStringFromElement

protected static java.lang.String getStringFromElement(org.w3c.dom.Element e)
Gets the transformed string from the specified element

Parameters:
e -
Returns:
transformed string


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