public class SqlXmlUtil
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
private static class |
SqlXmlUtil.NullNamespaceContext |
A NamespaceContext that reports all namespaces as unbound.
|
private class |
SqlXmlUtil.XMLErrorHandler |
| Modifier and Type | Field | Description |
|---|---|---|
private javax.xml.parsers.DocumentBuilder |
dBuilder |
|
private javax.xml.xpath.XPathExpression |
query |
The compiled XPath query.
|
private javax.xml.namespace.QName |
returnType |
The return type of the XPath query.
|
private javax.xml.transform.Transformer |
serializer |
| Constructor | Description |
|---|---|
SqlXmlUtil() |
Constructor: Initializes objects required for parsing
and serializing XML values.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
compileXQExpr(java.lang.String queryExpr,
java.lang.String opName) |
Take the received string, which is an XML query expression,
compile it, and store the compiled query locally.
|
private java.lang.Object |
evaluate(org.w3c.dom.Document doc) |
Evaluate the XPath query on the specified document.
|
protected java.util.List |
evalXQExpression(XMLDataValue xmlContext,
boolean returnResults,
int[] resultXType) |
Evaluate this object's compiled XML query expression against
the received xmlContext.
|
private void |
loadSerializer() |
Create an instance of Xalan serializer for the sake of
serializing an XML value according the SQL/XML specification
for serialization.
|
protected java.lang.String |
serializeToString(java.lang.String xmlAsText) |
Take a string representing an XML value and serialize it
according SQL/XML serialization rules.
|
protected java.lang.String |
serializeToString(java.util.List items,
XMLDataValue xmlVal) |
Take an array list (sequence) of XML nodes and/or string values
and serialize that entire list according to SQL/XML serialization
rules, which ultimately point to XML serialization rules as
defined by w3c.
|
private javax.xml.parsers.DocumentBuilder dBuilder
private javax.xml.transform.Transformer serializer
private javax.xml.xpath.XPathExpression query
private javax.xml.namespace.QName returnType
null if it is unknown.public SqlXmlUtil()
throws StandardException
StandardExceptionpublic void compileXQExpr(java.lang.String queryExpr,
java.lang.String opName)
throws StandardException
queryExpr - The XPath expression to compileStandardExceptionprotected java.lang.String serializeToString(java.lang.String xmlAsText)
throws java.lang.Exception
xmlAsText - String version of XML on which to perform
serialization.java.lang.Exceptionprotected java.lang.String serializeToString(java.util.List items,
XMLDataValue xmlVal)
throws javax.xml.transform.TransformerException
items - List of items to serialize. It should either be
a list of a single string value (in case it's the result of
an XMLQUERY operation that returns an atomic value), or a list
of zero or more Node objects.xmlVal - XMLDataValue into which the serialized string
returned by this method is ultimately going to be stored.
This is used for keeping track of XML values that represent
sequences having top-level (parentless) attribute nodes.javax.xml.transform.TransformerExceptionprotected java.util.List evalXQExpression(XMLDataValue xmlContext, boolean returnResults, int[] resultXType) throws java.lang.Exception
xmlContext - The XML value against which to evaluate
the stored (compiled) query expressionreturnResults - Whether or not to return the actual
results of the queryresultXType - The qualified XML type of the result
of evaluating the expression, if returnResults is true.
If the result is a sequence of exactly one Document node
then this will be XML(DOCUMENT(ANY)); else it will be
XML(SEQUENCE). If returnResults is false, this value
is ignored.java.lang.Exception - thrown on error (and turned into a
StandardException by the caller).private java.lang.Object evaluate(org.w3c.dom.Document doc)
throws javax.xml.xpath.XPathExpressionException
javax.xml.xpath.XPathExpressionExceptionprivate void loadSerializer()
throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationExceptionApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.