com.ibm.commerce.tools.epromotion.util
Class XmlHelper

java.lang.Object
  |
  +--com.ibm.commerce.tools.epromotion.util.XmlHelper

public class XmlHelper
extends java.lang.Object

Xml Helper is helping passing XML String to DOM object, or generating XML String from objects.


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
static java.lang.String EFFECTIVE_DATE_FORMAT
          Effective date format, this is locale independent.
static java.lang.String EFFECTIVE_DATE_FORMAT_BLAZE
          Effective date format in XML presentation, for Blaze rule engine only.
static java.lang.String EFFECTIVE_TIME_FORMAT
          Effective time format in XML presentation, for rules based discount only.
static java.lang.String EFFECTIVE_TIMESTAMP_FORMAT
          Effective timestamp format, which is locale independent.
static java.lang.String EFFECTIVE_TIMESTAMP_FORMAT_BLAZE
          Effective timestamp format in XML presentation, for Blaze rule script only.
static java.lang.String MAX_EFFECTIVE_DATE_VALUE
          Maximum effective date value, which is locale independent.
static java.lang.String MAX_EFFECTIVE_DATE_VALUE_BLAZE
          Maximum effective date value in XML presentation, for Blaze rule engine only.
static java.lang.String MAX_EFFECTIVE_TIME_VALUE
          Maximum effective time value in XML presentation, for rules based discount only.
static java.lang.String MAX_EFFECTIVE_TIMESTAMP
          Maximum effective timestamp in XML presentation, for rules based discount only.
static java.lang.String MIN_EFFECTIVE_DATE_VALUE
          Minimum effective date value, which is locale independent.
static java.lang.String MIN_EFFECTIVE_DATE_VALUE_BLAZE
          Minimum effective date value in XML presentation, for Blaze rule engine only.
static java.lang.String MIN_EFFECTIVE_TIME_VALUE
          Minimum effective time value in XML presentation, for rules based discount only.
static java.lang.String MIN_EFFECTIVE_TIMESTAMP
          Minimum effective timestamp in XML presentation, for rules based discount only.
static java.lang.String SCHEDULING_TIME_FORMAT
          Scheduling time format in XML presentation, for rules based discount only.
static java.lang.String TEXT_AMPERSAND
          Ampersand in XML presentation.
static java.lang.String TEXT_DOUBLE_QUOTE
          Double quote in XML presentation
static java.lang.String TEXT_DOUBLE_QUOTE_FOR_BLAZE
          Double quote for XML presentation and Blaze presentation.
static java.lang.String TEXT_LEFT_ANGLE_BRACKET
          Left angle bracket in XML presentation.
static java.lang.String TEXT_RIGHT_ANGLE_BRACKET
          Right angle bracket in XML presentation.
static java.lang.String TEXT_SINGLE_QUOTE
          Single quote in XML presentation.
 
Constructor Summary
XmlHelper()
          XmlHelper constructor
 
Method Summary
 java.lang.String generateCategoryXMLStringByCatgroupId(java.lang.String identifierTag, java.lang.String dNTag, java.lang.String catgroupId)
          This method is used to generate the XML representation of a catalog group by identifier and DN.
 java.lang.String generateProductXMLStringByCatentryId(java.lang.String partNumberTag, java.lang.String dNTag, java.lang.String catentryId)
          This method is using to generate the XML representation of a catalog entry by partNumber and DN.
 java.lang.String generateShippingModeXMLStringByShipModeId(java.lang.String codeTag, java.lang.String carrierTag, java.lang.String storeNameTag, java.lang.String ownerDNTag, java.lang.String shipModeId)
          This method is using to generate the XML representation of shipmode by code and carrier.
static java.util.Vector getElementTextValue(org.w3c.dom.Document document, java.lang.String elementTagName)
          This Method is used to find the String Value, which is the text node of the element node based on the given element tag name from the give Document object.
static java.util.Vector getElementTextValue(java.lang.String xmlString, java.lang.String elementTagName)
          This method will return a Vector of all posible text values which match the given element tag name in the Document Object generated from the given XML String.
static org.w3c.dom.Document getXMLDocument(java.lang.String xmlString)
          Generator the xml Document object based on the XML String input.
static java.lang.String normalizeXmlValue(java.lang.String s)
          Normalizes the given string for xml paser.
static java.lang.String normalizeXmlValueForBlaze(java.lang.String s)
          Normalizes the given string.
static void printDocTree(org.w3c.dom.Node node, java.lang.String indent)
          This method will print a DOM Node out and then recurse on its children.
static java.lang.String readXmlCharData(java.lang.String s)
          This method will transform predefined XML entity references into the normal character data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
See Also:
Constant Field Values

EFFECTIVE_DATE_FORMAT

public static final java.lang.String EFFECTIVE_DATE_FORMAT
Effective date format, this is locale independent. ie. Modified to adopt "31-12-9999" format.
See Also:
Constant Field Values

EFFECTIVE_DATE_FORMAT_BLAZE

public static final java.lang.String EFFECTIVE_DATE_FORMAT_BLAZE
Effective date format in XML presentation, for Blaze rule engine only.
See Also:
Constant Field Values

EFFECTIVE_TIME_FORMAT

public static final java.lang.String EFFECTIVE_TIME_FORMAT
Effective time format in XML presentation, for rules based discount only.
See Also:
Constant Field Values

SCHEDULING_TIME_FORMAT

public static final java.lang.String SCHEDULING_TIME_FORMAT
Scheduling time format in XML presentation, for rules based discount only.
See Also:
Constant Field Values

MAX_EFFECTIVE_DATE_VALUE

public static final java.lang.String MAX_EFFECTIVE_DATE_VALUE
Maximum effective date value, which is locale independent.
See Also:
Constant Field Values

MAX_EFFECTIVE_DATE_VALUE_BLAZE

public static final java.lang.String MAX_EFFECTIVE_DATE_VALUE_BLAZE
Maximum effective date value in XML presentation, for Blaze rule engine only.
See Also:
Constant Field Values

MAX_EFFECTIVE_TIME_VALUE

public static final java.lang.String MAX_EFFECTIVE_TIME_VALUE
Maximum effective time value in XML presentation, for rules based discount only.
See Also:
Constant Field Values

MIN_EFFECTIVE_DATE_VALUE

public static final java.lang.String MIN_EFFECTIVE_DATE_VALUE
Minimum effective date value, which is locale independent.
See Also:
Constant Field Values

MIN_EFFECTIVE_DATE_VALUE_BLAZE

public static final java.lang.String MIN_EFFECTIVE_DATE_VALUE_BLAZE
Minimum effective date value in XML presentation, for Blaze rule engine only.
See Also:
Constant Field Values

MIN_EFFECTIVE_TIME_VALUE

public static final java.lang.String MIN_EFFECTIVE_TIME_VALUE
Minimum effective time value in XML presentation, for rules based discount only.
See Also:
Constant Field Values

MIN_EFFECTIVE_TIMESTAMP

public static final java.lang.String MIN_EFFECTIVE_TIMESTAMP
Minimum effective timestamp in XML presentation, for rules based discount only.
See Also:
Constant Field Values

MAX_EFFECTIVE_TIMESTAMP

public static final java.lang.String MAX_EFFECTIVE_TIMESTAMP
Maximum effective timestamp in XML presentation, for rules based discount only.
See Also:
Constant Field Values

EFFECTIVE_TIMESTAMP_FORMAT

public static final java.lang.String EFFECTIVE_TIMESTAMP_FORMAT
Effective timestamp format, which is locale independent.
See Also:
Constant Field Values

EFFECTIVE_TIMESTAMP_FORMAT_BLAZE

public static final java.lang.String EFFECTIVE_TIMESTAMP_FORMAT_BLAZE
Effective timestamp format in XML presentation, for Blaze rule script only.
See Also:
Constant Field Values

TEXT_AMPERSAND

public static final java.lang.String TEXT_AMPERSAND
Ampersand in XML presentation.
See Also:
Constant Field Values

TEXT_DOUBLE_QUOTE

public static final java.lang.String TEXT_DOUBLE_QUOTE
Double quote in XML presentation
See Also:
Constant Field Values

TEXT_DOUBLE_QUOTE_FOR_BLAZE

public static final java.lang.String TEXT_DOUBLE_QUOTE_FOR_BLAZE
Double quote for XML presentation and Blaze presentation.
See Also:
Constant Field Values

TEXT_LEFT_ANGLE_BRACKET

public static final java.lang.String TEXT_LEFT_ANGLE_BRACKET
Left angle bracket in XML presentation.
See Also:
Constant Field Values

TEXT_RIGHT_ANGLE_BRACKET

public static final java.lang.String TEXT_RIGHT_ANGLE_BRACKET
Right angle bracket in XML presentation.
See Also:
Constant Field Values

TEXT_SINGLE_QUOTE

public static final java.lang.String TEXT_SINGLE_QUOTE
Single quote in XML presentation.
See Also:
Constant Field Values
Constructor Detail

XmlHelper

public XmlHelper()
XmlHelper constructor
Method Detail

getElementTextValue

public static java.util.Vector getElementTextValue(java.lang.String xmlString,
                                                   java.lang.String elementTagName)
This method will return a Vector of all posible text values which match the given element tag name in the Document Object generated from the given XML String.
Parameters:
xmlString - a String in XML format
elementTagName - java.lang.String
Returns:
java.util.Vector

getElementTextValue

public static java.util.Vector getElementTextValue(org.w3c.dom.Document document,
                                                   java.lang.String elementTagName)
This Method is used to find the String Value, which is the text node of the element node based on the given element tag name from the give Document object. The text node and element node should be one-one match. This will return a Vector of all posible text values which match the given element tag name in the given Document. Creation date: (5/2/2001 1:47:51 PM)
Parameters:
document - org.w3c.dom.Document
elementTagName - java.lang.String
Returns:
java.util.Vector

getXMLDocument

public static org.w3c.dom.Document getXMLDocument(java.lang.String xmlString)
Generator the xml Document object based on the XML String input.
Returns:
org.w3c.dom.Document

normalizeXmlValue

public static java.lang.String normalizeXmlValue(java.lang.String s)
Normalizes the given string for xml paser.
Parameters:
s - java.lang.String
Returns:
normalizedXmlString java.lang.String

normalizeXmlValueForBlaze

public static java.lang.String normalizeXmlValueForBlaze(java.lang.String s)
Normalizes the given string. This is for XML paser and Blaze rule project, skip their limitation. Blaze could only read '\"' as double quot.
Parameters:
s - java.lang.String
Returns:
normalizedXmlString java.lang.String

readXmlCharData

public static java.lang.String readXmlCharData(java.lang.String s)
This method will transform predefined XML entity references into the normal character data. XML predefined exactly five entity references as below: < > & " ' This method will be using to read the character data inside the XML elements and attributs.
Parameters:
s - java.lang.String
Returns:
originalCharData java.lang.String

printDocTree

public static void printDocTree(org.w3c.dom.Node node,
                                java.lang.String indent)
This method will print a DOM Node out and then recurse on its children.
Parameters:
node - org.w3c.dom.Node
indent - java.lang.String

generateShippingModeXMLStringByShipModeId

public java.lang.String generateShippingModeXMLStringByShipModeId(java.lang.String codeTag,
                                                                  java.lang.String carrierTag,
                                                                  java.lang.String storeNameTag,
                                                                  java.lang.String ownerDNTag,
                                                                  java.lang.String shipModeId)
                                                           throws ECException
This method is using to generate the XML representation of shipmode by code and carrier. The storeEntityId will be getting from commandContext, this will be the unique index of shipmode_id. This method is for massloading purpose only, replace the shipmode primary key with its unique index.
Parameters:
codeTag - java.lang.String
carrierTag - java.lang.String
storeNameTag - java.lang.String
ownerDNTag - java.lang.String
shipModeId - java.lang.String
Returns:
xmlString java.lang.String
Throws:
ECException

generateProductXMLStringByCatentryId

public java.lang.String generateProductXMLStringByCatentryId(java.lang.String partNumberTag,
                                                             java.lang.String dNTag,
                                                             java.lang.String catentryId)
                                                      throws ECException
This method is using to generate the XML representation of a catalog entry by partNumber and DN. This method is for massloading purpose only, replace the catentry_id primary key with its unique index.
Parameters:
partNumberTag - java.lang.String
dNTag - java.lang.String
catentryId - java.lang.String
Returns:
xmlString java.lang.String
Throws:
ECException

generateCategoryXMLStringByCatgroupId

public java.lang.String generateCategoryXMLStringByCatgroupId(java.lang.String identifierTag,
                                                              java.lang.String dNTag,
                                                              java.lang.String catgroupId)
                                                       throws ECException
This method is used to generate the XML representation of a catalog group by identifier and DN. This method is for massloading purpose only, replace the catgroup_id primary key with its unique index.
Parameters:
identifierTag - java.lang.String
dNTag - java.lang.String
catgroupId - java.lang.String
Returns:
xmlString java.lang.String
Throws:
ECException