com.ibm.broker.plugin

Class MbElement

  • java.lang.Object
    • com.ibm.broker.plugin.MbElement
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      void addAfter(MbElement element)
      Adds an unattached syntax element after this element.
      void addAsFirstChild(MbElement element)
      Adds an unattached syntax element as the first of this element.
      void addAsLastChild(MbElement element)
      Adds an unattached syntax element as the last of this element.
      void addBefore(MbElement element)
      Adds an unattached syntax element before this element.
      MbElement copy() 
      void copyElementTree(MbElement element)
      Copies the element tree from the element passed as an argument to the current element.
      MbElement createElementAfter(int type)
      Creates a new syntax element and inserts it after this element.
      MbElement createElementAfter(int type, java.lang.String name, java.lang.Object value)
      Creates a new syntax element and inserts it after this element.
      MbElement createElementAfter(java.lang.String parserName)
      Creates a new syntax element, inserts it after this element, and associates it with the specified parser class name.
      MbElement createElementAsFirstChild(int type)
      Creates a new syntax element as the first child of this element.
      MbElement createElementAsFirstChild(int type, java.lang.String name, java.lang.Object value)
      Creates a new syntax element as the first child of this element.
      MbElement createElementAsFirstChild(java.lang.String parserName)
      Creates a new syntax element as the first child of this element, and associates it with the specified parser class name.
      MbElement createElementAsLastChild(int type)
      Creates a new syntax element as the last child of this element.
      MbElement createElementAsLastChild(int type, java.lang.String name, java.lang.Object value)
      Creates a new syntax element as the last child of this element.
      MbElement createElementAsLastChild(java.lang.String parserName)
      Creates a new syntax element as the last child of this element, and associates it with the specified parser class name.
      MbElement createElementAsLastChildFromBitstream(byte[] bitstream, java.lang.String parserName, java.lang.String messageType, java.lang.String messageSet, java.lang.String messageFormat, int encoding, int ccsid, int options)
      Creates a new syntax element tree as the last child of this element, and associates it with the specified parser.
      MbElement createElementBefore(int type)
      Creates a new syntax element and inserts it before this element.
      MbElement createElementBefore(int type, java.lang.String name, java.lang.Object value)
      Creates a new syntax element and inserts it before this element.
      MbElement createElementBefore(java.lang.String parserName)
      Creates a new syntax element, inserts it before this element, and associates it with the specified parser class name.
      void delete()
      Detaches and destroys a portion of a message tree, allowing its memory to be reused.
      void detach()
      Detaches this element from the syntax element tree.
      java.lang.Object evaluateXPath(MbXPath xpath)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      java.lang.Object evaluateXPath(MbXPath xpath, MbXPathVariables xpathVariables)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      java.lang.Object evaluateXPath(java.lang.String expression)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      java.lang.Object evaluateXPath(java.lang.String expression, MbNamespaceBindings namespaceBindings)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      java.lang.Object evaluateXPath(java.lang.String expression, MbNamespaceBindings namespaceBindings, MbXPathVariables xpathVariables)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      java.lang.Object evaluateXPath(java.lang.String expression, MbXPathVariables xpathVariables)
      Evaluates the XPath 1.0 expression with the current element as the context node.
      MbElement[] getAllElementsByPath(java.lang.String path)
      Deprecated. 
      Path selection should be done using the XPath 1.0 methods.
      org.w3c.dom.Node getDOMNode()
      Returns this MbElement as an instance of the org.w3c.dom.Node interface
      MbElement getFirstChild()
      Returns the syntax element representing the first child of this element.
      MbElement getFirstElementByPath(java.lang.String path)
      Gets the first element matching the path specification.
      MbElement getLastChild()
      Returns the syntax element representing the last child of this element.
      java.lang.String getName()
      Returns the name of the element.
      java.lang.String getNamespace()
      Returns the namespace URI of the element.
      MbElement getNextSibling()
      Returns the syntax element representing the next sibling (right sibling) of this element.
      MbElement getParent()
      Returns the syntax element representing the parent of this element.
      java.lang.String getParserClassName()
      Gets the name of the parser associated with the element.
      int getParserContext()
      Deprecated. 
      getSpecificType() should be used instead.
      MbElement getPreviousSibling()
      Returns the syntax element representing the previous sibling (left sibling) of this element.
      int getSpecificType()
      Returns the full type information of this element including the parser specific type.
      int getType()
      Gets the generic type of the element.
      java.lang.Object getValue()
      Gets the value of the element as a java Object.
      java.lang.String getValueAsString()
      Gets the value of the element as a java String.
      int getValueState()
      Gets the state of the value of the element.
      boolean is(MbElement comparisonElement)
      is: Returns true if the MbElement actually refers to the same element in the logical message tree.
      boolean isReadOnly()
      Returns true if this element is part of the message that is read only.
      void setName(java.lang.String name)
      Sets the name of the element, any previous name is overwritten.
      void setNamespace(java.lang.String namespace)
      Sets the namespace URI of the element, any previous namespace is overwritten.
      void setSpecificType(int type)
      Sets the full type information for this element including the parser specific type.
      void setValue(java.lang.Object value)
      Sets the value of the element as a java Object.
      byte[] toBitstream(java.lang.String messageType, java.lang.String messageSet, java.lang.String messageFormat, int encoding, int ccsid, int options)
      Returns the bit stream representation of the element.
      java.lang.String toString()
      Returns a String representation of the MbElement.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TYPE_UNKNOWN

        public static final int TYPE_UNKNOWN
        The element type is undefined.
        See Also:
        Constant Field Values
      • TYPE_NAME

        public static final int TYPE_NAME
        A name element has associated with it a string, which is the name of the element.
        See Also:
        Constant Field Values
      • TYPE_VALUE

        public static final int TYPE_VALUE
        A value element has a value associated with it.
        See Also:
        Constant Field Values
      • TYPE_NAME_VALUE

        public static final int TYPE_NAME_VALUE
        A name-value element is an optimization of the case where a name element contains only a value element and nothing else. The element contains both a name and value.
        See Also:
        Constant Field Values
      • VALIDATE_ROOT_BITSTREAM

        public static final int VALIDATE_ROOT_BITSTREAM
        The Validation constants represent the allowed control options which are used when parsing or writing (between a bitstream and a structure in the logical view of the message). Only one option from each of the groups 1 - 4 can be specified, with the exception of ValidateValue and ValidateContent, which can be used together to obtain the content and value validation. If you do not specify an option within a group, the option with the zero value from that group is used. See the topic "Validation properties" in the Knowledge Center (topic: ac18870) for more details. VALIDATE_ROOT_BITSTREAM requests parsing or serializing of an entire message tree. This option belongs to Group 1: Bitstream Options.
        See Also:
        Constant Field Values
      • VALIDATE_CONTENT_AND_VALUE

        public static final int VALIDATE_CONTENT_AND_VALUE
        VALIDATE_CONTENT_AND_VALUE requests validation of the message content and values. This option belongs to Group 2: Validation Options.
        See Also:
        Constant Field Values
      • VALIDATE_VALUE

        public static final int VALIDATE_VALUE
        VALIDATE_VALUE requests validation of the message values. This option belongs to Group 2: Validation Options.
        See Also:
        Constant Field Values
      • VALIDATE_CONTENT

        public static final int VALIDATE_CONTENT
        VALIDATE_CONTENT requests validation of the message content. This option belongs to Group 2: Validation Options.
        See Also:
        Constant Field Values
      • VALIDATE_NONE

        public static final int VALIDATE_NONE
        VALIDATE_NONE requests no validation is performed. This option belongs to Group 2: Validation Options.
        See Also:
        Constant Field Values
      • VALIDATE_EXCEPTIONLIST

        public static final int VALIDATE_EXCEPTIONLIST
        VALIDATE_EXCEPTIONLIST requests validation failures are sent to the ExceptionList. This option belongs to Group 3: Validation Failure Options.
        See Also:
        Constant Field Values
      • VALIDATE_EXCEPTION

        public static final int VALIDATE_EXCEPTION
        VALIDATE_EXCEPTION requests validation failures are thrown as an exception. This option belongs to Group 3: Validation Failure Options.
        See Also:
        Constant Field Values
      • VALIDATE_LOCAL_ERROR

        public static final int VALIDATE_LOCAL_ERROR
        VALIDATE_LOCAL_ERROR requests validation failures are logged. This option belongs to Group 3: Validation Failure Options.
        See Also:
        Constant Field Values
      • VALIDATE_USERTRACE

        public static final int VALIDATE_USERTRACE
        VALIDATE_USERTRACE requests validation failures are logged to UserTrace. This option belongs to Group 3: Validation Failure Options.
        See Also:
        Constant Field Values
      • VALIDATE_COMPLETE

        public static final int VALIDATE_COMPLETE
        VALIDATE_COMPLETE requests complete validation. This option belongs to Group 4: Validation Timing Options.
        See Also:
        Constant Field Values
      • VALIDATE_IMMEDIATE

        public static final int VALIDATE_IMMEDIATE
        VALIDATE_IMMEDIATE requests immediate validation. This option belongs to Group 4: Validation Timing Options.
        See Also:
        Constant Field Values
      • VALIDATE_DEFERRED

        public static final int VALIDATE_DEFERRED
        VALIDATE_DEFERRED requests deferred validation. This option belongs to Group 4: Validation Timing Options.
        See Also:
        Constant Field Values
    • Method Detail

      • isReadOnly

        public boolean isReadOnly()
        Returns true if this element is part of the message that is read only.
      • createElementAfter

        public MbElement createElementAfter(int type)
                                     throws MbException
        Creates a new syntax element and inserts it after this element. The new element becomes the next sibling of this element and shares the same parent. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAfter(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAfter

        public MbElement createElementAfter(java.lang.String parserName)
                                     throws MbException
        Creates a new syntax element, inserts it after this element, and associates it with the specified parser class name. The new element becomes the next sibling of this element and shares the same parent.

        The portion of the syntax element tree that is owned by the parser may only have its effective root at the first generation of elements (that is, as immediate children of root). The user-defined node interface does not restrict the ability to create a subtree that appears to be owned by a different parser. However, it is not possible to serialize these element trees into a bit stream when outputting a message.

        Parameters:
        parserName - The name of the parser class. The supplied parser constants give values for some of the IBM supplied parsers. For example, MbBLOB.PARSER_NAME.
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAfter

        public MbElement createElementAfter(int type,
                                            java.lang.String name,
                                            java.lang.Object value)
                                     throws MbException
        Creates a new syntax element and inserts it after this element. The new element becomes the next sibling of this element and shares the same parent. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAfter(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        name - The name of the new element.
        value - The value of the new element as a Java Object. This must be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer
        • Double
        • BitSet
        Returns:
        The new element.
        Throws:
        MbException
      • createElementBefore

        public MbElement createElementBefore(int type)
                                      throws MbException
        Creates a new syntax element and inserts it before this element. The new element becomes the previous sibling of this element and shares the same parent. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementBefore(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        Returns:
        The new element.
        Throws:
        MbException
      • createElementBefore

        public MbElement createElementBefore(java.lang.String parserName)
                                      throws MbException
        Creates a new syntax element, inserts it before this element, and associates it with the specified parser class name. The new element becomes the previous sibling of this element and shares the same parent.

        The portion of the syntax element tree that is owned by the parser may only have its effective root at the first generation of elements (that is, as immediate children of root). The user-defined node interface does not restrict the ability to create a subtree that appears to be owned by a different parser. However, it is not possible to serialize these element trees into a bit stream when outputting a message.

        Parameters:
        parserName - The name of the parser class. The supplied parser constants give values for some of the IBM supplied parsers. For example, MbBLOB.PARSER_NAME.
        Returns:
        The new element.
        Throws:
        MbException
      • createElementBefore

        public MbElement createElementBefore(int type,
                                             java.lang.String name,
                                             java.lang.Object value)
                                      throws MbException
        Creates a new syntax element and inserts it before this element. The new element becomes the previous sibling of this element and shares the same parent. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementBefore(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        name - The name of the new element.
        value - The value of the new element as a Java Object. This must be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer
        • Double
        • BitSet
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsFirstChild

        public MbElement createElementAsFirstChild(int type)
                                            throws MbException
        Creates a new syntax element as the first child of this element. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAsFirstChild(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsFirstChild

        public MbElement createElementAsFirstChild(java.lang.String parserName)
                                            throws MbException
        Creates a new syntax element as the first child of this element, and associates it with the specified parser class name.

        The portion of the syntax element tree that is owned by the parser may only have its effective root at the first generation of elements (that is, as immediate children of root). The user-defined node interface does not restrict the ability to create a subtree that appears to be owned by a different parser. However, it is not possible to serialize these element trees into a bit stream when outputting a message.

        Parameters:
        parserName - The name of the parser class. The supplied parser constants give values for some of the IBM supplied parsers. For example, MbBLOB.PARSER_NAME.
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsFirstChild

        public MbElement createElementAsFirstChild(int type,
                                                   java.lang.String name,
                                                   java.lang.Object value)
                                            throws MbException
        Creates a new syntax element as the first child of this element. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAsFirstChild(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        name - The name of the new element.
        value - The value of the new element as a Java Object. This must be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer
        • Double
        • BitSet
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsLastChild

        public MbElement createElementAsLastChild(int type)
                                           throws MbException
        Creates a new syntax element as the last child of this element. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAsLastChild(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsLastChild

        public MbElement createElementAsLastChild(java.lang.String parserName)
                                           throws MbException
        Creates a new syntax element as the last child of this element, and associates it with the specified parser class name.

        The portion of the syntax element tree that is owned by the parser may only have its effective root at the first generation of elements (that is, as immediate children of root). The user-defined node interface does not restrict the ability to create a subtree that appears to be owned by a different parser. However, it is not possible to serialize these element trees into a bit stream when outputting a message.

        Parameters:
        parserName - The name of the parser class. The supplied parser constants give values for some of the IBM supplied parsers. For example, MbBLOB.PARSER_NAME.
        Returns:
        The new element.
        Throws:
        MbException
      • createElementAsLastChild

        public MbElement createElementAsLastChild(int type,
                                                  java.lang.String name,
                                                  java.lang.Object value)
                                           throws MbException
        Creates a new syntax element as the last child of this element. Do not use this method when creating a message body folder (such as XML, XMLNS, MRM, MIME, BLOB). This method should be used only when the message body folder has been created. To create the message body folder, use createElementAsLastChild(parserName)
        Parameters:
        type - The type of syntax element to be created. This must be either a valid specific type value for the associated parser or one of the following generic types:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        name - The name of the new element.
        value - The value of the new element as a Java Object. This must be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer
        • Double
        • BitSet
        Returns:
        The new element.
        Throws:
        MbException
      • getName

        public java.lang.String getName()
                                 throws MbException
        Returns the name of the element.
        Returns:
        The name of the element.
        Throws:
        MbException
      • setName

        public void setName(java.lang.String name)
                     throws MbException
        Sets the name of the element, any previous name is overwritten.
        Parameters:
        name - The new name of the element.
        Throws:
        MbException
      • getNamespace

        public java.lang.String getNamespace()
                                      throws MbException
        Returns the namespace URI of the element.
        Returns:
        The namespace URI of the element.
        Throws:
        MbException
      • setNamespace

        public void setNamespace(java.lang.String namespace)
                          throws MbException
        Sets the namespace URI of the element, any previous namespace is overwritten.
        Parameters:
        namespace - The new namespace URI of the element.
        Throws:
        MbException
      • getType

        public int getType()
                    throws MbException
        Gets the generic type of the element. Values are:
        • TYPE_NAME
        • TYPE_VALUE
        • TYPE_NAME_VALUE
        • TYPE_UNKNOWN
        Returns:
        Element type.
        Throws:
        MbException
      • getParserContext

        public int getParserContext()
                             throws MbException
        Deprecated. getSpecificType() should be used instead.
        Gets parser specific information for this element. In the 'C' interface this is refered to as the Specific Type.
        Returns:
        Parser specific information for this element
        Throws:
        MbException
      • getSpecificType

        public int getSpecificType()
                            throws MbException
        Returns the full type information of this element including the parser specific type.
        Returns:
        The full parser specific type of this element
        Throws:
        MbException
      • setSpecificType

        public void setSpecificType(int type)
                             throws MbException
        Sets the full type information for this element including the parser specific type. Knowledge of type values for the parser is required to use this method. Type values for the generic XML parsers are given in the MbXML, MbXMLNS and MbXMLNSC classes.
        Parameters:
        type - The full parser specific type for this element
        Throws:
        MbException
      • getValue

        public java.lang.Object getValue()
                                  throws MbException
        Gets the value of the element as a java Object. This can be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer 32-bit values.
        • Long 64-bit values.
        • Double
        • BigDecimal
        • BitSet
        Returns:
        Java object representing the value of the element.
        Throws:
        MbException
      • getValueAsString

        public java.lang.String getValueAsString()
                                          throws MbException
        Gets the value of the element as a java String.
        Returns:
        Java String representing the value of the element.
        Throws:
        MbException
      • setValue

        public void setValue(java.lang.Object value)
                      throws MbException
        Sets the value of the element as a java Object. This can be one of the types:
        • MbDate
        • MbTime
        • MbTimestamp
        • Boolean
        • byte[]
        • String
        • Integer 32-bit values.
        • Long 64-bit values.
        • Double
        • BigDecimal
        • BitSet
        An exception is thrown if the Object is not one of these types. An exception is also thrown if a BigDecimal value with more than 31 significant figures is passed into this method. The user should use one of the BigDecimal's rounding modes if necessary to avoid this.
        Parameters:
        value - The java Object representing the value of the element.
        Throws:
        MbException
      • getValueState

        public int getValueState()
                          throws MbException
        Gets the state of the value of the element. Return values are:
        • VALUE_STATE_UNDEFINED
        • VALUE_STATE_VALID
        • VALUE_STATE_INVALID
        Returns:
        The state of the value.
        Throws:
        MbException
      • getParserClassName

        public java.lang.String getParserClassName()
                                            throws MbException
        Gets the name of the parser associated with the element.
        Returns:
        The name of the parser, or null of there is no associated parser.
        Throws:
        MbException
      • getParent

        public MbElement getParent()
                            throws MbException
        Returns the syntax element representing the parent of this element.
        Returns:
        The parent MbElement
        Throws:
        MbException
      • getNextSibling

        public MbElement getNextSibling()
                                 throws MbException
        Returns the syntax element representing the next sibling (right sibling) of this element.
        Returns:
        The next sibling MbElement.
        Throws:
        MbException
      • getPreviousSibling

        public MbElement getPreviousSibling()
                                     throws MbException
        Returns the syntax element representing the previous sibling (left sibling) of this element.
        Returns:
        The previous sibling MbElement.
        Throws:
        MbException
      • getFirstChild

        public MbElement getFirstChild()
                                throws MbException
        Returns the syntax element representing the first child of this element.
        Returns:
        The first child of the element.
        Throws:
        MbException
      • getLastChild

        public MbElement getLastChild()
                               throws MbException
        Returns the syntax element representing the last child of this element.
        Returns:
        The last child of the element.
        Throws:
        MbException
      • evaluateXPath

        public java.lang.Object evaluateXPath(java.lang.String expression)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        Parameters:
        expression - The XPath 1.0 expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • evaluateXPath

        public java.lang.Object evaluateXPath(java.lang.String expression,
                                              MbNamespaceBindings namespaceBindings)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        If the expression contains location steps with namespace prefixes, the mapping of these prefixes to namespace URIs must be supplied. This is done with the namespaceBindings parameter. The MbNamespaceBindings object must have an entry for each prefix used in the XPath expression.
        Parameters:
        expression - The XPath 1.0 expression.
        namespaceBindings - Associated object containing the namespace prefix to URI mappings for this expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • evaluateXPath

        public java.lang.Object evaluateXPath(java.lang.String expression,
                                              MbXPathVariables xpathVariables)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        If the expression contains variable references, these variables must be assigned values. This is done with the xpathVariables parameter. The MbXPathVariables object must have an entry for each variable used in the XPath expression.
        Parameters:
        expression - The XPath 1.0 expression.
        xpathVariables - Associated object containing the variable bindings for this expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • evaluateXPath

        public java.lang.Object evaluateXPath(java.lang.String expression,
                                              MbNamespaceBindings namespaceBindings,
                                              MbXPathVariables xpathVariables)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        If the expression contains location steps with namespace prefixes, the mapping of these prefixes to namespace URIs must be supplied. This is done with the namespaceBindings parameter. The MbNamespaceBindings object must have an entry for each prefix used in the XPath expression.

        If the expression contains variable references, these variables must be assigned values. This is done with the xpathVariables parameter. The MbXPathVariables object must have an entry for each variable used in the XPath expression.

        Parameters:
        expression - The XPath 1.0 expression.
        namespaceBindings - Associated object containing the namespace prefix to URI mappings for this expression.
        xpathVariables - Associated object containing the variable bindings for this expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • evaluateXPath

        public java.lang.Object evaluateXPath(MbXPath xpath)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        Parameters:
        xpath - The MbXPath object representing the XPath 1.0 expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • evaluateXPath

        public java.lang.Object evaluateXPath(MbXPath xpath,
                                              MbXPathVariables xpathVariables)
                                       throws MbException
        Evaluates the XPath 1.0 expression with the current element as the context node. The return type depends on the expression and can be one of:
        • Boolean
        • Double
        • String
        • java.util.List of MbElement objects representing an XPath 1.0 nodeset
        If the expression contains variable references, these variables must be assigned values. This is done with the xpathVariables parameter. The MbXPathVariables object must have an entry for each variable used in the XPath expression.
        Parameters:
        xpath - The MbXPath object representing the XPath 1.0 expression.
        xpathVariables - Associated object containing the variable bindings for this expression.
        Throws:
        MbException - - An exception was thrown during the compilation of the expression.
      • getFirstElementByPath

        public MbElement getFirstElementByPath(java.lang.String path)
                                        throws MbException
        Gets the first element matching the path specification.

        The format of the path specification is the same as that described in getAllElementsByPath except that the descendant separator ('//') is not supported. This method returns the first element matched by the path specification only and is intended for use when you know the exact unique path to an element in the tree. In this case, this method is far more efficient than calling getAllElementsByPath and selecting the first element from the array.

        Example paths:

        item select the first child element named 'item' of the current element.
        /MQMD/ReplyToQselect the element representing the reply-to queue in the MQMD header.
        Returns:
        The element specified by the path
        Throws:
        MbException
      • getAllElementsByPath

        public MbElement[] getAllElementsByPath(java.lang.String path)
                                         throws MbException
        Deprecated. Path selection should be done using the XPath 1.0 methods.
        Get all the elements matching the path specification

        The path is a list of steps separated by a slash '/' character. Each step moves the selection pointer further into the element tree using the following rules:

        nameselects all children of the current element whose name attribute is name.
        *selects all children of the current element.
        .selects the current element.
        ..selects the parent of the current element.

        The steps can also be separated by a double slash ('//'), which causes all descendants of the current node to be searched rather than just the children. Descendants are children, children of children and so on.

        Paths are relative to the current element unless they start with a /, in which case they are absolute (that is, they are relative to the root element of the message).

        Examples: (click on (xml...) to show the result on an XML message)

        item selects all the child elements named 'item' of the current element. (xml...)
        order/item selects all grandchildren named 'item' that have a parent named 'order'. (xml...)
        ../item selects all siblings named 'item' (children of the parent). (xml...)
        order//item selects all 'item' descendants of all children named 'order'. (xml...)
        order/* selects all the children of all children named 'order'. (xml...)
        //item selects all elements named 'item' in the whole message. (xml...)
        .//item selects all elements named 'item' which are descendants of the current element. (xml...)
        /MQMD/ReplyToQselect the element representing the reply-to queue in the MQMD header.
        Returns:
        An array of all elements matched by the path specification.
        Throws:
        MbException
      • addAfter

        public void addAfter(MbElement element)
                      throws MbException
        Adds an unattached syntax element after this element. The currently unattached syntax element, and any child elements it might possess, is connected to the syntax element tree after the target (this) element. The newly added element becomes the next sibling of this element. The target (this) element must be attached to a tree (that is, it must have a parent element).
        Parameters:
        element - The currently unattached element to be added.
        Throws:
        MbException
      • addBefore

        public void addBefore(MbElement element)
                       throws MbException
        Adds an unattached syntax element before this element. The currently unattached syntax element, and any child elements it might possess, is connected to the syntax element tree before the target (this) element. The newly added element becomes the previous sibling of this element. The target (this) element must be attached to a tree (that is, it must have a parent element).
        Parameters:
        element - The currently unattached element to be added.
        Throws:
        MbException
      • addAsFirstChild

        public void addAsFirstChild(MbElement element)
                             throws MbException
        Adds an unattached syntax element as the first of this element. The currently unattached syntax element, and any child elements it might possess, is connected to the syntax element tree as the first child of the target (this) element. The target (this) element need not be attached.
        Parameters:
        element - The currently unattached element to be added.
        Throws:
        MbException
      • addAsLastChild

        public void addAsLastChild(MbElement element)
                            throws MbException
        Adds an unattached syntax element as the last of this element. The currently unattached syntax element, and any child elements it might possess, is connected to the syntax element tree as the last child of the target (this) element. The target (this) element need not be attached.
        Parameters:
        element - The currently unattached element to be added.
        Throws:
        MbException
      • copyElementTree

        public void copyElementTree(MbElement element)
                             throws MbException
        Copies the element tree from the element passed as an argument to the current element. Only the child elements of the source element are copied. Before the copy is performed, all existing child elements of the target (this) element are deleted, to be replaced by the child elements of the source element.
        Parameters:
        element - Source element for copy.
        Throws:
        MbException
      • detach

        public void detach()
                    throws MbException
        Detaches this element from the syntax element tree. The element is detached from its parent and siblings, but any child elements are left attached. Calling detach on the root element of a message or an element that is already detached will have no effect.
        Throws:
        MbException
      • delete

        public void delete()
                    throws MbException
        Detaches and destroys a portion of a message tree, allowing its memory to be reused. This method is particularly useful when handling very large messages.
        Throws:
        MbException
      • is

        public boolean is(MbElement comparisonElement)
        is: Returns true if the MbElement actually refers to the same element in the logical message tree.
        Parameters:
        comparisonElement - The element being compared.
        Returns:
        The boolean indicating if they are the same.
      • toBitstream

        public byte[] toBitstream(java.lang.String messageType,
                                  java.lang.String messageSet,
                                  java.lang.String messageFormat,
                                  int encoding,
                                  int ccsid,
                                  int options)
                           throws MbException
        Returns the bit stream representation of the element. This method causes the parser associated with the element to serialize the element and all its children. This method can only be called on the message body, i.e. the last child of the message root.
        Parameters:
        messageType - The message type definition used to create the bit stream from the element tree. A value of null will cause this parameter to be ignored.
        messageSet - The message set definition used to create the bit stream from the element tree. A value of null will cause this parameter to be ignored.
        messageFormat - The message format definition used to create the bit stream from the element tree. A value of null will cause this parameter to be ignored.
        encoding - The encoding to use when writing the bit stream. A special value of 0 may be supplied to indicate that the queue manager's encoding should be used.
        ccsid - The coded character set identifier to use when writing the bit stream. A special value of 0 may be supplied to indicate that the queue manager's ccsid should be used. A ccsid of -1 indicates that the bit stream is to be generated using ccsid information contained in the subtree consisting of the field pointed to by the element and its children. Currently no parsers support this option.
        options - This parameter controls the validation options used when creating the bitstream. A value of 0 means no validation is to be performed. For a list of valid options see the VALIDATE_* constants defined in MbElement.
        Returns:
        The message bit stream.
        Throws:
        MbException
      • createElementAsLastChildFromBitstream

        public MbElement createElementAsLastChildFromBitstream(byte[] bitstream,
                                                               java.lang.String parserName,
                                                               java.lang.String messageType,
                                                               java.lang.String messageSet,
                                                               java.lang.String messageFormat,
                                                               int encoding,
                                                               int ccsid,
                                                               int options)
                                                        throws MbException
        Creates a new syntax element tree as the last child of this element, and associates it with the specified parser. The new syntax element tree is populated by parsing the specified bit stream. This method can only be used to create a message body i.e. last child of message root.
        Parameters:
        bitstream - The bit stream to be parsed and added to the element tree.
        parserName - The name of the parser class to use to parse the bit stream. The same parser must be used to parse the whole bit stream.
        messageType - The message type definition used to create the element tree from the bit stream. A value of null will cause this parameter to be ignored.
        messageSet - The message set definition used to create the element tree from the bit stream. A value of null will cause this parameter to be ignored.
        messageFormat - The message format definition used to create the element tree from the bit stream. A value of null will cause this parameter to be ignored.
        encoding - The encoding to use when parsing the bit stream. A special value of 0 may be supplied to indicate that the queue manager's encoding should be used.
        ccsid - The coded character set identifier to use when parsing the bit stream. This parameter is mandatory. A special value of 0 may be supplied to indicate that the queue manager's ccsid should be used.
        options - This parameter controls the validation options used when parsing the bitstream. A value of 0 means no validation is to be performed. For a list of valid options see the VALIDATE_* constants defined in MbElement.
        Throws:
        MbException
      • getDOMNode

        public org.w3c.dom.Node getDOMNode()
                                    throws MbException
        Returns this MbElement as an instance of the org.w3c.dom.Node interface
        Throws:
        MbException
      • toString

        public java.lang.String toString()
        Returns a String representation of the MbElement. This string is for debug use only; its format is not guaranteed to stay the same between releases.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representing the element.
IBM Integration BusTM
JavaTM Plugin Node API