Top Description Fields Constructors Methods
org.apache.derby.iapi.types

public Class XML

extends DataType
implements XMLDataValue, StreamStorable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.StreamStorable, org.apache.derby.iapi.types.XMLDataValue, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.types.Orderable, org.apache.derby.iapi.services.io.Storable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.cache.ClassSize, org.apache.derby.iapi.services.io.ArrayInputStream, .StoredFormatIds, .StreamStorable, .Storable, .TypedFormat, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.conn.ConnectionUtil, org.apache.derby.shared.common.reference.SQLState, java.sql.ResultSet, .SQLException, .Types, java.text.RuleBasedCollator, java.io.InputStream, .IOException, .ObjectOutput, .ObjectInput, java.util.List

This type implements the XMLDataValue interface and thus is the type on which all XML related operations are executed. The first and simplest XML store implementation is a UTF-8 based one--all XML data is stored on disk as a UTF-8 string, just like the other Derby string types. In order to make it possible for smarter XML implementations to exist in the future, this class always writes an "XML implementation id" to disk before writing the rest of its data. When reading the data, the impl id is read first and serves as an indicator of how the rest of the data should be read. So long as there's only one implementation (UTF-8) the impl id can be ignored; but when smarter implementations are written, the impl id will be the key to figuring out how an XML value should be read, written, and processed.

Field Summary

Modifier and TypeField and Description
private static final int
private boolean
private SqlXmlUtil
protected static final short
public static final int
public static final int
private static String
private SQLChar
public static final short
public static final short
public static final short
public static final short
public static final short
public static final short
private int

Constructor Summary

AccessConstructor and Description
public
XML()

Default constructor.

private
XML(SQLChar
A SQLChar instance to clone and use for this XML value.
val
,
int
Qualified XML type for "val"
xmlType
,
boolean
Whether or not "val" corresponds to sequence with one or more top-level attribute nodes.
seqWithAttr
,
boolean
whether or not to force materialization of the underlying source data
materialize
)

Private constructor used for the cloneValue method.

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if JAXP is installed, or false otherwise
checkJAXPRequirement
()

Check if we have a JAXP implementation installed.

public static void
checkXMLRequirements()

See if the required JAXP and Xalan classes are in the user's classpath.

private static boolean

Returns:

true if XPath is supported, or false otherwise
checkXPathRequirement
()

Check if XPath is supported on this platform.

public DataValueDescriptor
cloneValue(boolean
any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false
forceMaterialization
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Clone this DataValueDescriptor.

public int
compare(DataValueDescriptor
The Orderable to compare this one to.
other
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare two XML DataValueDescriptors.

public int
estimateMemoryUsage()

Implements org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Estimate the memory usage in bytes of the data value and the overhead of the class.

public int
getLength()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Gets the length of the data value.

public DataValueDescriptor
getNewNull()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

public String
getString()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getString.

Gets the value in the data value descriptor as a String.

public int
getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get a universally unique identifier for the type of this object.

public String
getTypeName()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

public int
getXType()

Implements org.apache.derby.iapi.types.XMLDataValue.getXType.

Retrieve this XML value's qualified type.

public boolean
hasTopLevelAttr()

Implements org.apache.derby.iapi.types.XMLDataValue.hasTopLevelAttr.

Return whether or not this XML value represents a sequence that has one or more top-level attribute nodes.

public boolean
isNull()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Return whether the value is null or not.

public void
loadStream()

Implements org.apache.derby.iapi.services.io.StreamStorable.loadStream.

Set the value by reading the stream and converting it to an object form.

public void
markAsHavingTopLevelAttr()

Implements org.apache.derby.iapi.types.XMLDataValue.markAsHavingTopLevelAttr.

Take note of the fact this XML value represents an XML sequence that has one or more top-level attribute nodes.

public void
normalize(DataTypeDescriptor
The type to normalize the source column to
desiredType
,
DataValueDescriptor
The value to normalize
source
)

Overrides org.apache.derby.iapi.types.DataType.normalize.

Implements org.apache.derby.iapi.types.DataValueDescriptor.normalize.

Normalization method - this method will always be called when storing an XML value into an XML column, for example, when inserting/updating.

public void
readExternal(ObjectInput
The stream from which we're reading.
in
)

Implements java.io.Externalizable.readExternal.

Read an XML value from an input stream.

public void
readExternalFromArray(ArrayInputStream
The array stream positioned at the beginning of the byte stream to read from.
in
)

Overrides org.apache.derby.iapi.types.DataType.readExternalFromArray.

Implements org.apache.derby.iapi.types.DataValueDescriptor.readExternalFromArray.

Read the DataValueDescriptor from the stream.

public void
restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

public InputStream
returnStream()

Implements org.apache.derby.iapi.services.io.StreamStorable.returnStream.

Return the on-disk stream state of the object.

protected void
setFrom(DataValueDescriptor
The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.
theValue
)

Overrides org.apache.derby.iapi.types.DataType.setFrom.

Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor.

public void
setStream(InputStream
The new stream to use
newStream
)

Implements org.apache.derby.iapi.services.io.StreamStorable.setStream.

sets the on-disk stream state for the object.

public final void
setValueFromResultSet(ResultSet
The specified ResultSet.
resultSet
,
int
The 1-based column # into the resultSet.
colNumber
,
boolean
Whether or not the column is nullable (No need to call wasNull() if not)
isNullable
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet.

public void
setXType(int xtype)

Implements org.apache.derby.iapi.types.XMLDataValue.setXType.

Set this XML value's qualified type.

public int
public void
writeExternal(ObjectOutput
The stream to which we're writing.
out
)

Implements java.io.Externalizable.writeExternal.

Write an XML value.

public BooleanDataValue

Returns:

True if evaluation of the query expression stored in sqlxUtil returns at least one node for this XML value; unknown if the xml value is NULL; false otherwise.
XMLExists
(SqlXmlUtil
Contains SQL/XML objects and util methods that facilitate execution of XML-related operations
sqlxUtil
)

Implements org.apache.derby.iapi.types.XMLDataValue.XMLExists.

The SQL/XML XMLExists operator.

public XMLDataValue

Returns:

If 'text' constitutes a valid XML document, it has been stored in this XML value and this XML value is returned; otherwise, an exception is thrown.
XMLParse
(StringDataValue
The string value to check.
stringValue
,
boolean
Whether or not to preserve ignorable whitespace.
preserveWS
,
SqlXmlUtil
Contains SQL/XML objects and util methods that facilitate execution of XML-related operations
sqlxUtil
)

Implements org.apache.derby.iapi.types.XMLDataValue.XMLParse.

Method to parse an XML string and, if it's valid, store the _serialized_ version locally and then return this XMLDataValue.

public XMLDataValue

Returns:

An XMLDataValue whose content corresponds to the serialized version of the results from evaluation of the query expression.

Note

this XMLDataValue may not be storable into Derby XML columns.

XMLQuery
(SqlXmlUtil
Contains SQL/XML objects and util methods that facilitate execution of XML-related operations
sqlxUtil
,
XMLDataValue
The result of a previous call to this method; null if not called yet.
result
)

Implements org.apache.derby.iapi.types.XMLDataValue.XMLQuery.

Evaluate the XML query expression contained within the received util object against this XML value and store the results into the received XMLDataValue "result" param (assuming "result" is non-null; else create a new XMLDataValue).

public StringDataValue

Returns:

A serialized (to string) version of this XML object, in the form of a StringDataValue object.
XMLSerialize
(StringDataValue
The result of a previous call to this method, null if not called yet.
result
,
int
The string type to which we want to serialize.
targetType
,
int
The width of the target type.
targetWidth
,
int
The collation type of the target type.
targetCollationType
)

Implements org.apache.derby.iapi.types.XMLDataValue.XMLSerialize.

The SQL/XML XMLSerialize operator.

Inherited from org.apache.derby.iapi.types.DataType:
checkHostVariablecloneHoldercoalescecomparecomparecomparecompareTodataTypeConversionequalsequalsflipgenericSetObjectgetBooleangetBytegetBytesgetDategetDoublegetFloatgetIntgetLonggetObjectgetShortgetStreamgetTimegetTimestampgetTraceStringgetTypeNamegreaterOrEqualsgreaterThanhasStreamininvalidFormatisNotNullisNullOplessOrEqualslessThannotEqualsoutOfRangerecyclesetBigDecimalsetIntosetIntosetObjectsetObjectForCastsetToNullsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuethrowLangSetMismatchthrowLangSetMismatchtypeToBigDecimal

Field Detail

BASE_MEMORY_USAGEback to summary
private static final int BASE_MEMORY_USAGE
containsTopLevelAttrback to summary
private boolean containsTopLevelAttr
tmpUtilback to summary
private SqlXmlUtil tmpUtil
UTF8_IMPL_IDback to summary
protected static final short UTF8_IMPL_ID
XML_DOC_ANYback to summary
public static final int XML_DOC_ANY
XML_SEQUENCEback to summary
public static final int XML_SEQUENCE
xmlReqCheckback to summary
private static String xmlReqCheck
xmlStringValueback to summary
private SQLChar xmlStringValue
XQ_EMPTY_ON_EMPTYback to summary
public static final short XQ_EMPTY_ON_EMPTY
XQ_NULL_ON_EMPTYback to summary
public static final short XQ_NULL_ON_EMPTY
XQ_PASS_BY_REFback to summary
public static final short XQ_PASS_BY_REF
XQ_PASS_BY_VALUEback to summary
public static final short XQ_PASS_BY_VALUE
XQ_RETURN_CONTENTback to summary
public static final short XQ_RETURN_CONTENT
XQ_RETURN_SEQUENCEback to summary
public static final short XQ_RETURN_SEQUENCE
xTypeback to summary
private int xType

Constructor Detail

XMLback to summary
public XML()

Default constructor.

XMLback to summary
private XML(SQLChar val, int xmlType, boolean seqWithAttr, boolean materialize)

Private constructor used for the cloneValue method. Returns a new instance of XML whose fields are clones of the values received.

Parameters
val:SQLChar

A SQLChar instance to clone and use for this XML value.

xmlType:int

Qualified XML type for "val"

seqWithAttr:boolean

Whether or not "val" corresponds to sequence with one or more top-level attribute nodes.

materialize:boolean

whether or not to force materialization of the underlying source data

Method Detail

checkJAXPRequirementback to summary
private static boolean checkJAXPRequirement()

Check if we have a JAXP implementation installed.

Returns:boolean

true if JAXP is installed, or false otherwise

checkXMLRequirementsback to summary
public static void checkXMLRequirements() throws StandardException

See if the required JAXP and Xalan classes are in the user's classpath. Assumption is that we will always call this method before instantiating an instance of SqlXmlUtil, and thus we will never get a ClassNotFound exception caused by missing JAXP/Xalan classes. Instead, if either is missing we should throw an informative error indicating what the problem is.

Note

This method only does the checks necessary to allow successful instantiation of the SqlXmlUtil class. Further checks (esp. the presence of a JAXP _implementation_ in addition to the JAXP _interfaces_) are performed in the SqlXmlUtil constructor.

Exceptions
StandardException:
thrown if the required classes cannot be located in the classpath.
checkXPathRequirementback to summary
private static boolean checkXPathRequirement()

Check if XPath is supported on this platform.

Returns:boolean

true if XPath is supported, or false otherwise

cloneValueback to summary
public DataValueDescriptor cloneValue(boolean forceMaterialization)

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Clone this DataValueDescriptor. Results in a new object that has the same value as this but can be modified independently.

Even though the objects can be modified independently regardless of the value of forceMaterialization, both the clone and the original may be dependent on the store state if forceMaterialization is set to false. An example is if you need to access the value you just read using cloneValue after the current transaction has ended, or after the source result set has been closed.

Parameters
forceMaterialization:boolean

any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false

Returns:DataValueDescriptor

A clone of the DataValueDescriptor with the same initial value as this.

See Also
DataValueDescriptor#cloneValue
compareback to summary
public int compare(DataValueDescriptor other) throws StandardException

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare two XML DataValueDescriptors.

Note

This method should only be used by the database store for the purpose of index positioning--comparisons of XML type are not allowed from the language side of things. That said, all store wants to do is order the NULLs, so we don't actually have to do a full comparison. Just return an order value based on whether or not this XML value and the other XML value are null. As mentioned in the "compare" method of DataValueDescriptor, nulls are considered equal to other nulls and less than all other values. An example of when this method might be used is if the user executed a query like: select i from x_table where x_col is not null

Parameters
other:DataValueDescriptor

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

The Orderable to compare this one to.

Returns:int

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

<0 - this Orderable is less than other. 0 - this Orderable equals other. >0 - this Orderable is greater than other. The code should not explicitly look for -1, or 1.

Exceptions
StandardException:

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

Thrown on error

See Also
DataValueDescriptor#compare
estimateMemoryUsageback to summary
public int estimateMemoryUsage()

Implements org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Estimate the memory usage in bytes of the data value and the overhead of the class.

Returns:int

the estimated memory usage

See Also
DataValueDescriptor#estimateMemoryUsage
getLengthback to summary
public int getLength() throws StandardException

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Gets the length of the data value. The meaning of this is implementation-dependent. For string types, it is the number of characters in the string. For numeric types, it is the number of bytes used to store the number. This is the actual length of this value, not the length of the type it was defined as. For example, a VARCHAR value may be shorter than the declared VARCHAR (maximum) length.

Returns:int

The length of the data value

Exceptions
StandardException:
On error
See Also
DataValueDescriptor#getLength
getNewNullback to summary
public DataValueDescriptor getNewNull()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

See Also
DataValueDescriptor#getNewNull
getStringback to summary
public String getString() throws StandardException

Implements org.apache.derby.iapi.types.DataValueDescriptor.getString.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getString.

Gets the value in the data value descriptor as a String. Throws an exception if the data value is not a string.

Returns:String

The data value as a String.

Exceptions
StandardException:
Thrown on error
See Also
DataValueDescriptor#getString
getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Get a universally unique identifier for the type of this object.

Returns:int

The identifier. (A UUID stuffed in an array of 16 bytes).

See Also
From the engine's perspective, all XML implementations share the same format id.
getTypeNameback to summary
public String getTypeName()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

Returns:String

The SQL name of the datatype

See Also
DataValueDescriptor#getTypeName
getXTypeback to summary
public int getXType()

Implements org.apache.derby.iapi.types.XMLDataValue.getXType.

Retrieve this XML value's qualified type.

hasTopLevelAttrback to summary
public boolean hasTopLevelAttr()

Implements org.apache.derby.iapi.types.XMLDataValue.hasTopLevelAttr.

Return whether or not this XML value represents a sequence that has one or more top-level attribute nodes.

isNullback to summary
public boolean isNull()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Doc from org.apache.derby.iapi.services.io.Storable.isNull.

Return whether the value is null or not.

Returns:boolean

true if the value is null and false otherwise.

See Also
Storable#isNull
loadStreamback to summary
public void loadStream() throws StandardException

Implements org.apache.derby.iapi.services.io.StreamStorable.loadStream.

Doc from org.apache.derby.iapi.services.io.StreamStorable.loadStream.

Set the value by reading the stream and converting it to an object form.

Exceptions
StandardException:
on error
See Also
StreamStorable#loadStream
markAsHavingTopLevelAttrback to summary
public void markAsHavingTopLevelAttr()

Implements org.apache.derby.iapi.types.XMLDataValue.markAsHavingTopLevelAttr.

Take note of the fact this XML value represents an XML sequence that has one or more top-level attribute nodes.

normalizeback to summary
public void normalize(DataTypeDescriptor desiredType, DataValueDescriptor source) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.normalize.

Implements org.apache.derby.iapi.types.DataValueDescriptor.normalize.

Normalization method - this method will always be called when storing an XML value into an XML column, for example, when inserting/updating. We always force normalization in this case because we need to make sure the qualified type of the value we're trying to store is XML_DOC_ANY--we don't allow anything else.

Parameters
desiredType:DataTypeDescriptor

The type to normalize the source column to

source:DataValueDescriptor

The value to normalize

Exceptions
StandardException:
Thrown if source is not XML_DOC_ANY.
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException

Implements java.io.Externalizable.readExternal.

Read an XML value from an input stream.

Parameters
in:ObjectInput

The stream from which we're reading.

Exceptions
IOException:

Doc from java.io.Externalizable.readExternal.

if I/O errors occur

readExternalFromArrayback to summary
public void readExternalFromArray(ArrayInputStream in) throws IOException

Overrides org.apache.derby.iapi.types.DataType.readExternalFromArray.

Implements org.apache.derby.iapi.types.DataValueDescriptor.readExternalFromArray.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.readExternalFromArray.

Read the DataValueDescriptor from the stream.

Initialize the data value by reading it's values from the ArrayInputStream. This interface is provided as a way to achieve possible performance enhancement when reading an array can be optimized over reading from a generic stream from readExternal().

Parameters
in:ArrayInputStream

The array stream positioned at the beginning of the byte stream to read from.

Exceptions
IOException:
Usual error is if you try to read past limit on the stream.
See Also
DataValueDescriptor#readExternalFromArray
restoreToNullback to summary
public void restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Doc from org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

See Also
Storable#restoreToNull
returnStreamback to summary
public InputStream returnStream()

Implements org.apache.derby.iapi.services.io.StreamStorable.returnStream.

Doc from org.apache.derby.iapi.services.io.StreamStorable.returnStream.

Return the on-disk stream state of the object.

Returns:InputStream

a stream to read the object state

See Also
StreamStorable#returnStream
setFromback to summary
protected void setFrom(DataValueDescriptor theValue) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.setFrom.

Doc from org.apache.derby.iapi.types.DataType.setFrom.

Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor.

Parameters
theValue:DataValueDescriptor

The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.

See Also
DataType#setFrom
setStreamback to summary
public void setStream(InputStream newStream)

Implements org.apache.derby.iapi.services.io.StreamStorable.setStream.

Doc from org.apache.derby.iapi.services.io.StreamStorable.setStream.

sets the on-disk stream state for the object.

Parameters
newStream:InputStream

The new stream to use

See Also
StreamStorable#setStream
setValueFromResultSetback to summary
public final void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) throws SQLException

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet.

Parameters
resultSet:ResultSet

The specified ResultSet.

colNumber:int

The 1-based column # into the resultSet.

isNullable:boolean

Whether or not the column is nullable (No need to call wasNull() if not)

Exceptions
SQLException:
Error accessing the result set
See Also
DataValueDescriptor#setValueFromResultSet
setXTypeback to summary
public void setXType(int xtype)

Implements org.apache.derby.iapi.types.XMLDataValue.setXType.

Set this XML value's qualified type.

typePrecedenceback to summary
public int typePrecedence()

Overrides org.apache.derby.iapi.types.DataType.typePrecedence.

Implements org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Each built-in type in JSQL has a precedence. This precedence determines how to do type promotion when using binary operators. For example, float has a higher precedence than int, so when adding an int to a float, the result type is float. The precedence for some types is arbitrary. For example, it doesn't matter what the precedence of the boolean type is, since it can't be mixed with other types. But the precedence for the number types is critical. The SQL standard requires that exact numeric types be promoted to approximate numeric when one operator uses both. Also, the precedence is arranged so that one will not lose precision when promoting a type.

Returns:int

The precedence of this type.

See Also
DataValueDescriptor#typePrecedence
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Write an XML value.

Parameters
out:ObjectOutput

The stream to which we're writing.

Exceptions
IOException:

Doc from java.io.Externalizable.writeExternal.

Includes any I/O exceptions that may occur

XMLExistsback to summary
public BooleanDataValue XMLExists(SqlXmlUtil sqlxUtil) throws StandardException

Implements org.apache.derby.iapi.types.XMLDataValue.XMLExists.

The SQL/XML XMLExists operator. Checks to see if evaluation of the query expression contained within the received util object against this XML value returns at least one item.

Note

For now, the query expression must be XPath only (XQuery not supported) because that's what Xalan supports.

Parameters
sqlxUtil:SqlXmlUtil

Contains SQL/XML objects and util methods that facilitate execution of XML-related operations

Returns:BooleanDataValue

True if evaluation of the query expression stored in sqlxUtil returns at least one node for this XML value; unknown if the xml value is NULL; false otherwise.

Exceptions
StandardException:
Thrown on error
XMLParseback to summary
public XMLDataValue XMLParse(StringDataValue stringValue, boolean preserveWS, SqlXmlUtil sqlxUtil) throws StandardException

Implements org.apache.derby.iapi.types.XMLDataValue.XMLParse.

Method to parse an XML string and, if it's valid, store the _serialized_ version locally and then return this XMLDataValue.

Parameters
stringValue:StringDataValue

The string value to check.

preserveWS:boolean

Whether or not to preserve ignorable whitespace.

sqlxUtil:SqlXmlUtil

Contains SQL/XML objects and util methods that facilitate execution of XML-related operations

Returns:XMLDataValue

If 'text' constitutes a valid XML document, it has been stored in this XML value and this XML value is returned; otherwise, an exception is thrown.

Exceptions
StandardException:
Thrown on error.
XMLQueryback to summary
public XMLDataValue XMLQuery(SqlXmlUtil sqlxUtil, XMLDataValue result) throws StandardException

Implements org.apache.derby.iapi.types.XMLDataValue.XMLQuery.

Evaluate the XML query expression contained within the received util object against this XML value and store the results into the received XMLDataValue "result" param (assuming "result" is non-null; else create a new XMLDataValue).

Parameters
sqlxUtil:SqlXmlUtil

Contains SQL/XML objects and util methods that facilitate execution of XML-related operations

result:XMLDataValue

The result of a previous call to this method; null if not called yet.

Returns:XMLDataValue

An XMLDataValue whose content corresponds to the serialized version of the results from evaluation of the query expression.

Note

this XMLDataValue may not be storable into Derby XML columns.

Exceptions
StandardException:
thrown on error
XMLSerializeback to summary
public StringDataValue XMLSerialize(StringDataValue result, int targetType, int targetWidth, int targetCollationType) throws StandardException

Implements org.apache.derby.iapi.types.XMLDataValue.XMLSerialize.

The SQL/XML XMLSerialize operator. Serializes this XML value into a string with a user-specified character type, and returns that string via the received StringDataValue (if the received StringDataValue is non-null and of the correct type; else, a new StringDataValue is returned).

Parameters
result:StringDataValue

The result of a previous call to this method, null if not called yet.

targetType:int

The string type to which we want to serialize.

targetWidth:int

The width of the target type.

targetCollationType:int

Doc from org.apache.derby.iapi.types.XMLDataValue.XMLSerialize.

The collation type of the target type.

Returns:StringDataValue

A serialized (to string) version of this XML object, in the form of a StringDataValue object.

Exceptions
StandardException:
Thrown on error