net.sf.okapi.lib.xliff2.core

## Class ExtElement

- java.lang.Object
- - net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
  - - net.sf.okapi.lib.xliff2.core.ExtElement

- All Implemented Interfaces:
    IExtChild, IWithExtAttributes

      public class ExtElement
      extends DataWithExtAttributes
      implements IExtChild

  Represent an extension (or un-supported module) element.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExtElement(ExtElement original)` Copy constructor.
    `ExtElement(javax.xml.namespace.QName qName)` Creates a new `ExtElement` object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `IExtChild` | `addChild(IExtChild child)` Adds a `IExtChild` object to this element.
    `ExtContent` | `addContent(java.lang.String text)` Adds a text content to this element.
    `ExtElement` | `addElement(java.lang.String localPart)` Adds a child element to this element, both of the same namespace.
    `ExtElement` | `addElement(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)` Adds a child element to this element.
    `ExtAttributes` | `getAttributes()` Deprecated.
    `java.util.List<IExtChild>` | `getChildren()` Gets the list of the children of this element.
    `ExtContent` | `getFirstContent()` Gets the first child content of this element.
    `ExtElement` | `getFirstElement()` Gets the first child element of this element.
    `ExtElement` | `getFirstElement(java.lang.String namespaceURI, java.lang.String localName)` Gets the first element child for a given namespace and name of this element.
    `javax.xml.namespace.QName` | `getQName()` Gets the QName of this element.
    `ExtChildType` | `getType()` Gets the type of child this object is (one of the `ExtChildType` values).
    `boolean` | `hasChild()` Indicates if this element has at least one child.
    `boolean` | `isModule()` Indicates if this extension element is part of a module or not.

    - ### Methods inherited from class net.sf.okapi.lib.xliff2.core.DataWithExtAttributes

      `getExtAttributes, getExtAttributeValue, hasExtAttribute, setExtAttributes`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExtElement

          public ExtElement(ExtElement original)

      Copy constructor.
      Parameters:
        `original` - the original object to duplicate.

    - #### ExtElement

          public ExtElement(javax.xml.namespace.QName qName)

      Creates a new `ExtElement` object.
      Parameters:
        `qName` - the qualified name of the element.

  - ### Method Detail

    - #### getQName

          public javax.xml.namespace.QName getQName()

      Gets the QName of this element.
      Returns:
        the QName of this element.

    - #### getAttributes

          @Deprecated
          public ExtAttributes getAttributes()

      Deprecated.
      Gets the `ExtAttributes` object for this element. This is kept for backward compatibility, use `DataWithExtAttributes.getExtAttributes()` instead.
      Returns:
        the `ExtAttributes` object for this element.

    - #### getType

          public ExtChildType getType()

      Description copied from interface: `IExtChild`
      Gets the type of child this object is (one of the `ExtChildType` values).
      Specified by:
        `getType` in interface `IExtChild`
      Returns:
        the type of child this object is.

    - #### hasChild

          public boolean hasChild()

      Indicates if this element has at least one child.
      Returns:
        true if this element has at least one child, false otherwise.

    - #### getChildren

          public java.util.List<IExtChild> getChildren()

      Gets the list of the children of this element. An empty list is created if needed.
      Returns:
        list of the children of this element.
      See Also:
        `hasChild()`

    - #### getFirstElement

          public ExtElement getFirstElement(java.lang.String namespaceURI,
                                   java.lang.String localName)

      Gets the first element child for a given namespace and name of this element.
      Parameters:
        `namespaceURI` - the namespace URI of the element to retrieve.
        `localName` - the name of the element to retrieve.
      Returns:
        the first child element of the given namespace and name if it exists, or null if it does not.

    - #### getFirstElement

          public ExtElement getFirstElement()

      Gets the first child element of this element.
      Returns:
        the first child element of this element, or null if there is no child element.

    - #### getFirstContent

          public ExtContent getFirstContent()

      Gets the first child content of this element.
      Returns:
        the first child content of this element, or null if there is no child content.

    - #### addChild

          public IExtChild addChild(IExtChild child)

      Adds a `IExtChild` object to this element.
      Parameters:
        `child` - the object to add.
      Returns:
        the added object.

    - #### addElement

          public ExtElement addElement(java.lang.String namespaceURI,
                              java.lang.String localPart,
                              java.lang.String prefix)

      Adds a child element to this element.
      Parameters:
        `namespaceURI` - the namespace URI of the element to add.
        `localPart` - the local part of the name of the element to add.
        `prefix` - the prefix of the name of the element to add.
      Returns:
        the added element.

    - #### addElement

          public ExtElement addElement(java.lang.String localPart)

      Adds a child element to this element, both of the same namespace.
      Parameters:
        `localPart` - the local part of the name of the element to add.
      Returns:
        the added element.

    - #### addContent

          public ExtContent addContent(java.lang.String text)

      Adds a text content to this element.
      Parameters:
        `text` - the text to add.
      Returns:
        the added `ExtContent` object.

    - #### isModule

          public boolean isModule()

      Indicates if this extension element is part of a module or not.
      Returns:
        true if this extension element is part of a module.