com.ibm.commerce.foundation.dataload.util

Class XMLParseHelper

  • java.lang.Object
    • com.ibm.commerce.foundation.dataload.util.XMLParseHelper


  • public class XMLParseHelper
    extends java.lang.Object

    This class provides some static methods to help with XML parsing.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String getAttribute(org.w3c.dom.Node aNode, java.lang.String attributeName)
      This method will return the attribute value for an attribute inside of the provided XML node.
      static java.lang.String getAttribute(org.w3c.dom.Node aNode, java.lang.String attributeName, boolean encrypted)
      This method will return the attribute value for an attribute inside of the provided XML node.
      static void populateAttributes(org.w3c.dom.Node aNode, java.util.Map aProperties)
      This method will get all of the attributes for a given XML node, and populate the Map with the attribute name as the key and attribute value as the value.
      static void populateAttributes(org.w3c.dom.Node aNode, java.util.Map aProperties, boolean logAttributes)
      This method will get all of the attributes for a given XML node, and populate the Map with the attribute name as the key and attribute value as the value.
      static void populateBusinessContextProperties(org.w3c.dom.Node businessContextNode, ConfigProperties configProperties)
      This method adds business context properties to a Map of properties.
      static void populateBusinessContextProperties(org.w3c.dom.Node businessContextNode, java.util.Map propertyMap)
      This method adds business context properties to a Map of properties.
      static void populateChildProperties(org.w3c.dom.Node aNode, java.util.Map aProperties)
      This method searches XML nodes for child "property" or "contextProperty" nodes to populate in the Map as a set of properties.
      static void populateGroupPropertyMap(org.w3c.dom.Node aNode, ConfigProperties configProperties)
      This method adds a group of properties to a Map of properties.
      static void populateProperties(org.w3c.dom.Node aNode, java.util.Map aProperties)
      This method will parse property nodes in the form of name-value pairs and add them to the Map of properties.
      static java.lang.String resolveVariables(java.lang.String aString)
      Resolve the variable.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • populateChildProperties

        public static void populateChildProperties(org.w3c.dom.Node aNode,
                                                   java.util.Map aProperties)

        This method searches XML nodes for child "property" or "contextProperty" nodes to populate in the Map as a set of properties. The key of the output map (aProperties) is the name attribute of a child of the node.

        The value can be 1. A string if the name of child node is "property". 2. A ContextDataProperties object if the name of child node is "contextData".

        Parameters:
        aNode - An XML node.
        aProperties - The is output property map.
      • populateProperties

        public static void populateProperties(org.w3c.dom.Node aNode,
                                              java.util.Map aProperties)

        This method will parse property nodes in the form of name-value pairs and add them to the Map of properties.

        The key of the Map is the property name, the value in the Map is the property value.

        Parameters:
        aNode - An XML node.
        aProperties - A Map to store the property name and value parsed from the XML node.
      • populateAttributes

        public static void populateAttributes(org.w3c.dom.Node aNode,
                                              java.util.Map aProperties)

        This method will get all of the attributes for a given XML node, and populate the Map with the attribute name as the key and attribute value as the value.

        The attribute name and value will be logged to the level Level.FINEST

        Parameters:
        aNode - An XML node.
        aProperties - A Map to store the attribute name and value parsed from the XML node.
      • populateAttributes

        public static void populateAttributes(org.w3c.dom.Node aNode,
                                              java.util.Map aProperties,
                                              boolean logAttributes)

        This method will get all of the attributes for a given XML node, and populate the Map with the attribute name as the key and attribute value as the value.

        The attribute name and value will be logged to the level Level.FINEST if logAttributes is true, and not if it is false.

        Parameters:
        aNode - An XML node.
        aProperties - A Map to store the attribute name and value parsed from the XML node.
        logAttributes - A flag indicating whether to log the attributes.
      • resolveVariables

        public static java.lang.String resolveVariables(java.lang.String aString)
        Resolve the variable. The variable is in format of ${varaibleName}. After resolving, it will be replaced with the actual value. The value of the variable can be found in the system properties. If it is not there, in the j2se environment, the user will be prompted to enter the value. In the j2ee environment, if it is not found in the system properties, it will be replaced with the empty string.
        Parameters:
        aString - the input string which contains some variables.
        Returns:
        the resolved string, that is, the variables are replaced by their values.
      • getAttribute

        public static java.lang.String getAttribute(org.w3c.dom.Node aNode,
                                                    java.lang.String attributeName,
                                                    boolean encrypted)

        This method will return the attribute value for an attribute inside of the provided XML node.

        Parameters:
        aNode - An XML node.
        attributeName - The name of the attribute to retrieve the value for.
        encrypted - a flag to indicate if the attribute value is encrypted or not.
        Returns:
        String The attribute value of the attribute.
      • getAttribute

        public static java.lang.String getAttribute(org.w3c.dom.Node aNode,
                                                    java.lang.String attributeName)

        This method will return the attribute value for an attribute inside of the provided XML node.

        Parameters:
        aNode - An XML node.
        attributeName - The name of the attribute to retrieve the value for.
        Returns:
        String The attribute value of the attribute.
      • populateGroupPropertyMap

        public static void populateGroupPropertyMap(org.w3c.dom.Node aNode,
                                                    ConfigProperties configProperties)

        This method adds a group of properties to a Map of properties.

        Parameters:
        aNode - An XML node.
        configProperties - The data load configuration properties.
      • populateBusinessContextProperties

        public static void populateBusinessContextProperties(org.w3c.dom.Node businessContextNode,
                                                             ConfigProperties configProperties)

        This method adds business context properties to a Map of properties.

        Parameters:
        businessContextNode - A BusinessContext XML node.
        configProperties - The data load configuration properties.
      • populateBusinessContextProperties

        public static void populateBusinessContextProperties(org.w3c.dom.Node businessContextNode,
                                                             java.util.Map propertyMap)

        This method adds business context properties to a Map of properties.

        Parameters:
        businessContextNode - A BusinessContext XML node.
        propertyMap - A Map to store the business context properties.