Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.slide.util
Class XMLValue

    java.lang.Object
      org.apache.slide.util.XMLValue

All Implemented Interfaces:
  java.lang.Cloneable, java.lang.Comparable

public class XMLValue
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable

This class is a container for a list of JDOM Elements. The `toString()` method provides a XML document fragment describing the Elements of this XMLValue.

Version:
  $Revision: 1.6.2.1 $

Nested Class Summary
`protected static class` | `XMLValue.DefaultNamespaceXMLFilter` This XMLFilter uses the given namespace as the default, means if no namespace is provided.

Field Summary
`protected static java.lang.String` | `E_HREF`
`static java.lang.String` | `ELEMENT_MUST_NOT_BE_NULL` Constant for the message of the IllegalArgumentException that may be thrown in method `add()`.
`protected java.util.ArrayList` | `elementList` The list of JDOM Elements.
`protected static java.lang.String` | `END_TAG` The end tag used to create a valid document out of the XML Element list string in constructor `XMLValue(String)`.
`protected static java.lang.String` | `START_TAG` The start tag used to create a valid document out of the XML Element list string in constructor `XMLValue(String)`.
`static java.lang.String` | `TYPE_MISMATCH` Constant for the message of the IllegalArgumentException that may be thrown in constructor `XMLValue(List)`.

Constructor Summary
`XMLValue()` Creates a XMLValue.
`XMLValue(org.jdom.Element element)` Creates a XMLValue from the given `element`.
`XMLValue(java.util.List elementList)` Creates a XMLValue from the given `list` of JDOM Elements.
`XMLValue(java.lang.String xmlString)` Creates a XMLValue from the given String representation of a list of XML Elements.
`XMLValue(java.lang.String xmlString, org.jdom.Namespace defaultNamespace)` Creates a XMLValue from the given String representation of a list of XML Elements.

Method Summary
`void` | `add(org.jdom.CDATA cdata)` Adds a JDOM CDATA.
`void` | `add(org.jdom.Comment comment)` Adds a JDOM Comment.
`void` | `add(org.jdom.Element element)` Adds a JDOM Element.
`void` | `add(org.jdom.EntityRef eref)` Adds a JDOM EntityRef.
`void` | `add(java.util.List content)` Adds a List of JDOM items.
`void` | `add(org.jdom.ProcessingInstruction pi)` Adds a JDOM ProcessingInstruction.
`void` | `add(java.lang.String xmlString)` Adds the Elements given by an XML string representation.
`void` | `add(java.lang.String xmlString, org.jdom.Namespace defaultNamespace)` Adds the Elements given by an XML string representation.
`void` | `add(org.jdom.Text text)` Adds a JDOM Text.
`void` | `addHref(java.lang.String path)`
`java.lang.Object` | `clone()` Returns a clone of this instance.
`int` | `compareTo(java.lang.Object o)` compares the concatenated Text values of all Elements in elementList
`boolean` | `equals(java.lang.Object other)` Returns `true` if the other object is an XMLValue and both their String representations are equal.
`java.util.List` | `getHrefNodes()` Method getHrefs
`java.util.List` | `getHrefStrings()` Method getHrefs
`java.util.List` | `getList()` Returns a clone of the List of JDOM Elements.
`java.lang.String` | `getTextValue()` concatenates the text() values of all Elements in elementList
`int` | `hashCode()` Returns the hash code of this instance.
`java.util.Iterator` | `iterator()` Returns an iterator of JDOM Elements.
`int` | `size()` Returns the amount of JDOM elements.
`void` | `stripServletContext(java.lang.String servletContext)`
`java.lang.String` | `toString()` Returns a String representation of the Elements as a XML document fragment.

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### ELEMENT_MUST_NOT_BE_NULL

    public static final java.lang.String ELEMENT_MUST_NOT_BE_NULL

  Constant for the message of the IllegalArgumentException that may be thrown in method `add()`.

  See Also:
    Constant Field Values

### TYPE_MISMATCH

    public static final java.lang.String TYPE_MISMATCH

  Constant for the message of the IllegalArgumentException that may be thrown in constructor `XMLValue(List)`.

  See Also:
    Constant Field Values

### START_TAG

    protected static final java.lang.String START_TAG

  The start tag used to create a valid document out of the XML Element list string in constructor `XMLValue(String)`.

  See Also:
    Constant Field Values

### END_TAG

    protected static final java.lang.String END_TAG

  The end tag used to create a valid document out of the XML Element list string in constructor `XMLValue(String)`.

  See Also:
    Constant Field Values

### E_HREF

    protected static final java.lang.String E_HREF

See Also:
  Constant Field Values

### elementList

    protected java.util.ArrayList elementList

  The list of JDOM Elements.

Constructor Detail

### XMLValue

    public XMLValue()

  Creates a XMLValue.

### XMLValue

    public XMLValue(org.jdom.Element element)
             throws java.lang.IllegalArgumentException

  Creates a XMLValue from the given `element`.

Parameters:
  `element` - the JDOM Element to add to the list.
Throws:
  `java.lang.IllegalArgumentException` - if the given `element` is `null`.

### XMLValue

    public XMLValue(java.util.List elementList)
             throws java.lang.IllegalArgumentException

  Creates a XMLValue from the given `list` of JDOM Elements. the given List may be `null`.

Parameters:
  `elementList` - the list of JDOM Elements to add.
Throws:
  `java.lang.IllegalArgumentException` - if one of the list items is `null` or not a `Element`.

### XMLValue

    public XMLValue(java.lang.String xmlString)
             throws org.jdom.JDOMException

  Creates a XMLValue from the given String representation of a list of XML Elements.

Parameters:
  `xmlString` - a String representation of a list of XML Elements.
Throws:
  `org.jdom.JDOMException` - if parsing the `xmlString` fails.

### XMLValue

    public XMLValue(java.lang.String xmlString,
                    org.jdom.Namespace defaultNamespace)
             throws org.jdom.JDOMException

  Creates a XMLValue from the given String representation of a list of XML Elements. If the given `defaultNamespace` is not `null`, all nodes that does not have any namespace will be created with that Namespace.

Parameters:
  `xmlString` - a String representation of a list of XML Elements.
  `defaultNamespace` - the Namespace to use to create nodes that does not have any namespace. May be `null`.
Throws:
  `org.jdom.JDOMException` - if parsing the `xmlString` fails.

Method Detail

### add

    public void add(org.jdom.Element element)
             throws java.lang.IllegalArgumentException

  Adds a JDOM Element.

  Parameters:
    `element` - the JDOM Element to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `element` is `null`.

### add

    public void add(org.jdom.Text text)
             throws java.lang.IllegalArgumentException

  Adds a JDOM Text.

  Parameters:
    `text` - the JDOM Text to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `text` is `null`.

### add

    public void add(org.jdom.Comment comment)
             throws java.lang.IllegalArgumentException

  Adds a JDOM Comment.

  Parameters:
    `comment` - the JDOM Comment to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `comment` is `null`.

### add

    public void add(org.jdom.ProcessingInstruction pi)
             throws java.lang.IllegalArgumentException

  Adds a JDOM ProcessingInstruction.

  Parameters:
    `pi` - the JDOM ProcessingInstruction to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `pi` is `null`.

### add

    public void add(org.jdom.CDATA cdata)
             throws java.lang.IllegalArgumentException

  Adds a JDOM CDATA.

  Parameters:
    `cdata` - the JDOM CDATA to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `CDATA` is `null`.

### add

    public void add(org.jdom.EntityRef eref)
             throws java.lang.IllegalArgumentException

  Adds a JDOM EntityRef.

  Parameters:
    `eref` - the JDOM EntityRef to add.
  Throws:
    `java.lang.IllegalArgumentException` - if the given `entity ref` is `null`.

### add

    public void add(java.util.List content)
             throws java.lang.IllegalArgumentException

  Adds a List of JDOM items.

  Parameters:
    `content` - the list of JDOM items to add.
  Throws:
    `java.lang.IllegalArgumentException` - if one of the list items is `null` or not a `Element`.

### add

    public void add(java.lang.String xmlString)
             throws org.jdom.JDOMException

  Adds the Elements given by an XML string representation.

  Parameters:
    `xmlString` - a String representation of a list of XML Elements.
  Throws:
    `org.jdom.JDOMException` - if parsing the `xmlString` fails.

### add

    public void add(java.lang.String xmlString,
                    org.jdom.Namespace defaultNamespace)
             throws org.jdom.JDOMException

  Adds the Elements given by an XML string representation. If the given `namespace` is not `null`, all nodes that does not have any namespace will be created with that Namespace.

  Parameters:
    `xmlString` - a String representation of a list of XML Elements.
    `defaultNamespace` - the Namespace to use to create nodes that does not have any namespace. May be `null`.
  Throws:
    `org.jdom.JDOMException` - if parsing the `xmlString` fails.

### addHref

    public void addHref(java.lang.String path)

### getHrefStrings

    public java.util.List getHrefStrings()

  Method getHrefs

  Returns:
    a List of URIs (String)

### getHrefNodes

    public java.util.List getHrefNodes()

  Method getHrefs

  Returns:
    a List of nodes (SubjectNode)

### stripServletContext

    public void stripServletContext(java.lang.String servletContext)

### iterator

    public java.util.Iterator iterator()

  Returns an iterator of JDOM Elements.

  Returns:
    an iterator of JDOM Elements.

### size

    public int size()

  Returns the amount of JDOM elements.

  Returns:
    the amount of JDOM elements.

### getList

    public java.util.List getList()

  Returns a clone of the List of JDOM Elements.

  Returns:
    a clone of the List of JDOM Elements.

### equals

    public boolean equals(java.lang.Object other)

  Returns `true` if the other object is an XMLValue and both their String representations are equal.

  Parameters:
    `other` - the Object to test for equality.
  Returns:
    `true` if the other object is an XMLValue and both their String representations are equal.

### hashCode

    public int hashCode()

  Returns the hash code of this instance.

  Returns:
    the hash code of this instance.

### clone

    public java.lang.Object clone()

  Returns a clone of this instance.

  Returns:
    a clone of this instance.

### toString

    public java.lang.String toString()

  Returns a String representation of the Elements as a XML document fragment.

  Returns:
    a String representation of the Elements.

### getTextValue

    public java.lang.String getTextValue()

  concatenates the text() values of all Elements in elementList

  Returns:
    a String

### compareTo

    public int compareTo(java.lang.Object o)

  compares the concatenated Text values of all Elements in elementList

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Parameters:
    `o` - an Object
  Returns:
    an int

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD