## org.eclipse.jet.xpath.inspector
Interface IElementInspector

All Superinterfaces:
  INodeInspector

    public interface IElementInspector

extends INodeInspector

Specialization of `INodeInspector` for nodes where `getNodeKind()` returns `ELEMENT`.

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.jet.xpath.inspector.INodeInspector
`INodeInspector.NodeKind`

Method Summary
`java.lang.Object` `addElement(java.lang.Object node, ExpandedName elementName, java.lang.Object addBeforeThisSibling)` Create a new Element under context Node
`java.lang.Object` `addTextElement(java.lang.Object parentElement, java.lang.String name, java.lang.String bodyContent, boolean asCData)` Create a new text (simple) element under `parentElement` with the specified name and content.
`java.lang.Object` `copyElement(java.lang.Object tgtParent, java.lang.Object srcElement, java.lang.String name, boolean recursive)` Make a copy of `srcElement` under `tgtParent` with the specified name.
`boolean` `createAttribute(java.lang.Object node, java.lang.String attributeName, java.lang.String value)` Create the named attribute on the context node (which is an ELEMENT) and set its value to the passed value.
`java.lang.Object[]` `getAttributes(java.lang.Object node)` Return all the attributes for the given contextNode.
`java.lang.Object` `getNamedAttribute(java.lang.Object node, ExpandedName nameTestExpandedName)` Return the named attribute for the given contextNode.
`void` `removeAttribute(java.lang.Object node, java.lang.String name)` Remove the named attribute from the node that represents an element.
`void` `removeElement(java.lang.Object node)` Remove the specified element from its containing model.

Methods inherited from interface org.eclipse.jet.xpath.inspector.INodeInspector
`expandedNameOf, getChildren, getDocumentRoot, getNodeKind, getParent, nameOf, stringValueOf, testExpandedName`

Method Detail

### getAttributes

    java.lang.Object[] getAttributes(java.lang.Object node)

  Return all the attributes for the given contextNode. The implementer may assume the getNodeKind(contextNode) is NodeKind.ELEMENT.

  Parameters:
    `node` - an ELEMENT node
  Returns:
    an array of attributes. Return an empty array if there are not matches.

### getNamedAttribute

    java.lang.Object getNamedAttribute(java.lang.Object node,
                                       ExpandedName nameTestExpandedName)

  Return the named attribute for the given contextNode. The implementer may assume the getNodeKind(contextNode) is NodeKind.ELEMENT. The nameTestExpandedName will be in one of two forms: <bl>
  - `ExpandedName.getNamespaceURI()` returns null and `ExpandedName.getLocalPart()` is a name.
  - `ExpandedName.getNamespaceURI()` returns non-null and `ExpandedName.getLocalPart()` is a name.
  </bl> This method will not be called if the XPath nameTest includes a wild-card character (*).

  Parameters:
    `node` - the ELEMENT to search
    `nameTestExpandedName` - the expanded name of the attribute to find
  Returns:
    the attribute, or `null` if not found.

### createAttribute

    boolean createAttribute(java.lang.Object node,
                            java.lang.String attributeName,
                            java.lang.String value)

  Create the named attribute on the context node (which is an ELEMENT) and set its value to the passed value.

  This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Parameters:
    `node` -
    `attributeName` -
    `value` -
  Returns:
    `true` if the attribute could create the attribute, `false` otherwise.

### addElement

    java.lang.Object addElement(java.lang.Object node,
                                ExpandedName elementName,
                                java.lang.Object addBeforeThisSibling)
                                throws SimpleElementRequiresValueException,
                                       InvalidChildException

  Create a new Element under context Node

  Parameters:
    `node` - a the ELEMENT under which the new element will be created
    `elementName` - the expanded name for the new element.
    `addBeforeThisSibling` - a child of `contextNode` or `null`. If non-null, then the new element is inserted immediately before this element. If `null`, the new element will be added at the end of the appropriate collection of element children.

    This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Returns:
    the new element, or `null` if the element could not be created.
  Throws:
    `SimpleElementRequiresValueException`
    `InvalidChildException`

### removeElement

    void removeElement(java.lang.Object node)

  Remove the specified element from its containing model.

  This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Parameters:
    `node` - the ELEMENT which is to be removed.

### copyElement

    java.lang.Object copyElement(java.lang.Object tgtParent,
                                 java.lang.Object srcElement,
                                 java.lang.String name,
                                 boolean recursive)
                                 throws CopyElementException

  Make a copy of `srcElement` under `tgtParent` with the specified name.

  The implementation should check that `tgtParent` and `srcElement` are in the compatible meta-models.

  This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Parameters:
    `tgtParent` -
    `srcElement` -
    `name` -
    `recursive` -
  Returns:
    the newly copied element
  Throws:
    `CopyElementException` - if the copy cannot be successfully performed.

### addTextElement

    java.lang.Object addTextElement(java.lang.Object parentElement,
                                    java.lang.String name,
                                    java.lang.String bodyContent,
                                    boolean asCData)
                                    throws AddElementException

  Create a new text (simple) element under `parentElement` with the specified name and content.

  This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Parameters:
    `parentElement` -
    `name` -
    `bodyContent` -
    `asCData` - if `true`, add as a CDATA section
  Returns:
    the newly created text element.
  Throws:
    `AddElementException`

### removeAttribute

    void removeAttribute(java.lang.Object node,
                         java.lang.String name)

  Remove the named attribute from the node that represents an element.

  This method is optional. If not implemented, inspectors should throw `UnsupportedOperationException`.

  Parameters:
    `node` -
    `name` -

Copyright 2006 IBM Corporation and others. All Rights Reserved.