Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DbXML version 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.dbxml
Class XmlValue

    java.lang.Object
      com.sleepycat.dbxml.XmlValue

public class XmlValue
extends Object

The XmlValue class encapsulates the value of a node in an XML document. XPath 1.0 defines three value types: Boolean, String, and Number. Berkeley DB XML additionally defines the value types None, Node, Document, and Variable.

The XmlValue class provides several constructors, each of which maps a C++ type or Berkeley DB XML class onto an appropriate XmlValue type. The following table lists the constructor parameter mappings.

Java Type or Class | XmlValue Type
--- | ---
No parameter | Null
String | String
double | Number
boolean | Boolean
`XmlDocument` | Document
type and String | String is converted to the specified type.

The XmlValue class implements a set of methods that test if the XmlValue is of a named type. The XmlValue class also implements a set of methods that return the XmlValue as a value of a specified type. If the XmlValue is of type variable and no query context is provided when calling the test or cast methods, or no binding can be found for the variable, an exception is thrown.

### Description: XmlValue()

### Description: XmlValue(String)

### Description: XmlValue(double)

### Description: XmlValue(boolean)

### Description: XmlValue(Type, String)

### Description: XmlValue(XmlDocument)

### Description: XmlValue.isNumber(XmlQueryContext)

### Description: XmlValue.isString(XmlQueryContext)

### Description: XmlValue.isBoolean(XmlQueryContext)

### Description: XmlValue.isNode(XmlQueryContext)

### Description: XmlValue.isDocument(XmlQueryContext)

### Description: XmlValue.isVariable(XmlQueryContext)

### Description: XmlValue.getType(XmlQueryContext)

### Description: XmlValue.asNumber(XmlQueryContext)

### Description: XmlValue.asString(XmlQueryContext)

### Description: XmlValue.asBoolean(XmlQueryContext)

### Description: XmlValue.asDocument(XmlQueryContext)

### Description: XmlValue.isNull()

### Description: XmlValue.equals(XmlValue,XmlQueryContext)

The copy constructor and assignment operator are provided for this class. The class is implemented using a handle-body idiom. When a handle is copied both handles maintain a reference to the same body.

Field Summary
`static int` | `BINARY`
`static int` | `BOOLEAN`
`static int` | `DOCUMENT`
`static int` | `NODE`
`static int` | `NONE`
`static int` | `NUMBER`
`static int` | `STRING`
`static int` | `VARIABLE`

Constructor Summary
`XmlValue()`
`XmlValue(boolean v)` Construct an XmlValue object of value type Boolean.
`XmlValue(double v)` Construct an XmlValue object of value type Number.
`XmlValue(int type, String v)` Construct an XmlValue object of the value type provided, converting the string value to the specified type.
`XmlValue(String v)` Construct an XmlValue object of value type String.
`XmlValue(XmlDocument v)` Construct an XmlValue object of value type Document.

Method Summary
`boolean` | `asBoolean(XmlQueryContext context)`
`XmlDocument` | `asDocument(XmlQueryContext context)`
`double` | `asNumber(XmlQueryContext context)`
`String` | `asString(XmlQueryContext context)`
`void` | `delete()`
`boolean` | `equals(XmlValue value, XmlQueryContext context)` The equals() method determines if two XmlValue objects represent the same value.
`int` | `getType(XmlQueryContext context)`
`boolean` | `isBoolean(XmlQueryContext context)` Test if the XmlValue is of type Boolean.
`boolean` | `isDocument(XmlQueryContext context)` Test if the XmlValue is of type Node.
`boolean` | `isNode(XmlQueryContext context)` Test if the XmlValue is of type Node.
`boolean` | `isNull()`
`boolean` | `isNumber(XmlQueryContext context)` Test if the XmlValue is of type Number.
`boolean` | `isString(XmlQueryContext context)` Test if the XmlValue is of type String.
`boolean` | `isVariable(XmlQueryContext context)` Test if the XmlValue is of type Node.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NONE

    public static final int NONE

### STRING

    public static final int STRING

### NUMBER

    public static final int NUMBER

### BOOLEAN

    public static final int BOOLEAN

### DOCUMENT

    public static final int DOCUMENT

### NODE

    public static final int NODE

### VARIABLE

    public static final int VARIABLE

### BINARY

    public static final int BINARY

Constructor Detail

### XmlValue

    public XmlValue()
             throws XmlException

Throws:
  `XmlException`

### XmlValue

    public XmlValue(XmlDocument v)
             throws XmlException

  Construct an XmlValue object of value type Document.

Parameters:
  `v` - The XmlValue object value.
Throws:
  `XmlException`

### XmlValue

    public XmlValue(double v)
             throws XmlException

  Construct an XmlValue object of value type Number.

Parameters:
  `v` - The XmlValue object value.
Throws:
  `XmlException`

### XmlValue

    public XmlValue(String v)
             throws XmlException

  Construct an XmlValue object of value type String.

Parameters:
  `v` - The XmlValue object value.
Throws:
  `XmlException`

### XmlValue

    public XmlValue(boolean v)
             throws XmlException

  Construct an XmlValue object of value type Boolean.

Parameters:
  `v` - The XmlValue object value.
Throws:
  `XmlException`

### XmlValue

    public XmlValue(int type,
                    String v)
             throws XmlException

  Construct an XmlValue object of the value type provided, converting the string value to the specified type.

Parameters:
  `type` - The XmlValue object value type.
  `v` - The XmlValue object value.
Throws:
  `XmlException`

Method Detail

### delete

    public void delete()

### getType

    public int getType(XmlQueryContext context)
                throws XmlException

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns the type of the XmlValue . The enumeration values are XmlValue.NONE, XmlValue.STRING, XmlValue.NUMBER, XmlValue.BOOLEAN, XmlValue.DOCUMENT, XmlValue.NODE, XmlValue.VARIABLE.
  Throws:
    `XmlException`

### isNumber

    public boolean isNumber(XmlQueryContext context)
                     throws XmlException

  Test if the XmlValue is of type Number.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a Number.
  Throws:
    `XmlException`

### isString

    public boolean isString(XmlQueryContext context)
                     throws XmlException

  Test if the XmlValue is of type String.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a String.
  Throws:
    `XmlException`

### isBoolean

    public boolean isBoolean(XmlQueryContext context)
                      throws XmlException

  Test if the XmlValue is of type Boolean.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a Boolean.
  Throws:
    `XmlException`

### isNode

    public boolean isNode(XmlQueryContext context)
                   throws XmlException

  Test if the XmlValue is of type Node.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a Node.
  Throws:
    `XmlException`

### isDocument

    public boolean isDocument(XmlQueryContext context)
                       throws XmlException

  Test if the XmlValue is of type Node.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a Node.
  Throws:
    `XmlException`

### isVariable

    public boolean isVariable(XmlQueryContext context)
                       throws XmlException

  Test if the XmlValue is of type Node.

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the value is a Node.
  Throws:
    `XmlException`

### isNull

    public boolean isNull()
                   throws XmlException

  Returns:
    The isNull() method returns true if the XmlValue has no value.
  Throws:
    `XmlException`

### asNumber

    public double asNumber(XmlQueryContext context)
                    throws XmlException

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns the value as a Number.
  Throws:
    `XmlException`

### asString

    public String asString(XmlQueryContext context)
                    throws XmlException

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns the value as a String.
  Throws:
    `XmlException`

### asBoolean

    public boolean asBoolean(XmlQueryContext context)
                      throws XmlException

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns the value as a Boolean
  Throws:
    `XmlException`

### asDocument

    public XmlDocument asDocument(XmlQueryContext context)
                           throws XmlException

  Parameters:
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns the value as a Document.
  Throws:
    `XmlException`

### equals

    public boolean equals(XmlValue value,
                          XmlQueryContext context)
                   throws XmlException

  The equals() method determines if two XmlValue objects represent the same value.

  Parameters:
    `value` - The value to compare this value with.
    `context` - The query context is required to determine the value of an XmlValue of type variable.
  Returns:
    Returns true if the two XmlValue objects represent the same value.
  Throws:
    `XmlException`
    `XmlException` - The XmlValue cast methods may fail and throw `XmlException`, encapsulating one of the following non-zero errors:
    - No query context was provided, or the query context does not contain a value for the XmlValue of type variable.

Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DbXML version 1.2.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.