ContentDescriptor, AbstractReadHandle, AbstractWriteHandle, BufferableHandle, ContentHandle<org.w3c.dom.Document>, CtsQueryWriteHandle, DocumentMetadataReadHandle, DocumentMetadataWriteHandle, DocumentPatchHandle, QueryOptionsListReadHandle, QueryOptionsReadHandle, QueryOptionsWriteHandle, RuleListReadHandle, RuleReadHandle, RuleWriteHandle, SearchReadHandle, SPARQLResultsReadHandle, StructureReadHandle, StructureWriteHandle, TriplesReadHandle, TriplesWriteHandle, TuplesReadHandle, ValuesListReadHandle, ValuesReadHandle, XMLReadHandle, XMLWriteHandle, OutputStreamSenderpublic class DOMHandle extends BaseHandle<java.io.InputStream,OutputStreamSender> implements OutputStreamSender, BufferableHandle, ContentHandle<org.w3c.dom.Document>, XMLReadHandle, XMLWriteHandle, StructureReadHandle, StructureWriteHandle, CtsQueryWriteHandle
UNKNOWN_LENGTH| Constructor | Description |
|---|---|
DOMHandle() |
Zero-argument constructor.
|
DOMHandle(org.w3c.dom.Document content) |
Initializes the handle with a DOM document for the content.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected <T> T |
castAs(java.lang.Object result,
java.lang.Class<?> as) |
|
protected void |
checkContext(org.w3c.dom.Node context) |
|
javax.xml.xpath.XPathExpression |
compileXPath(java.lang.String xpathExpression) |
Compile an XPath string expression for efficient evaluation later.
|
<T> T |
evaluateXPath(java.lang.String xpathExpression,
java.lang.Class<T> as) |
Evaluate a string XPath expression against the retrieved document.
|
<T> T |
evaluateXPath(java.lang.String xpathExpression,
org.w3c.dom.Node context,
java.lang.Class<T> as) |
Evaluate a string XPath expression relative to a node such as a node
returned by a previous XPath expression.
|
<T> T |
evaluateXPath(javax.xml.xpath.XPathExpression xpathExpression,
java.lang.Class<T> as) |
Evaluate a compiled XPath expression against the retrieved document.
|
<T> T |
evaluateXPath(javax.xml.xpath.XPathExpression xpathExpression,
org.w3c.dom.Node context,
java.lang.Class<T> as) |
Evaluate a compiled XPath expression relative to a node such as a node
returned by a previous XPath expression.
|
void |
fromBuffer(byte[] buffer) |
Sets the content of the handle by copying from a byte array buffer
encoded in UTF-8.
|
org.w3c.dom.Document |
get() |
Returns the DOM document for the content.
|
javax.xml.parsers.DocumentBuilderFactory |
getFactory() |
Returns the factory for building DOM documents.
|
org.w3c.dom.ls.LSResourceResolver |
getResolver() |
Returns the resolver for resolving references while parsing the document.
|
javax.xml.xpath.XPath |
getXPathProcessor() |
Get the processor used to evaluate XPath expressions.
|
protected javax.xml.parsers.DocumentBuilderFactory |
makeDocumentBuilderFactory() |
|
protected javax.xml.xpath.XPathFactory |
makeXPathProcessorFactory() |
|
static ContentHandleFactory |
newFactory() |
Creates a factory to create a DOMHandle instance for a DOM document.
|
protected java.lang.Class<java.io.InputStream> |
receiveAs() |
|
protected void |
receiveContent(java.io.InputStream content) |
|
protected javax.xml.namespace.QName |
returnXPathConstant(java.lang.Class<?> as) |
|
protected OutputStreamSender |
sendContent() |
|
void |
set(org.w3c.dom.Document content) |
Assigns a DOM document as the content.
|
void |
setFactory(javax.xml.parsers.DocumentBuilderFactory factory) |
Specifies the factory for building DOM documents.
|
void |
setFormat(Format format) |
Restricts the format to XML.
|
void |
setResolver(org.w3c.dom.ls.LSResourceResolver resolver) |
Specifies the resolver for resolving references while parsing the document.
|
void |
setXPathProcessor(javax.xml.xpath.XPath xpathProcessor) |
Specifies the processor used to evaluate XPath expressions against
the document.
|
byte[] |
toBuffer() |
Copies the content of the handle to a byte array buffer
encoded in UTF-8.
|
java.lang.String |
toString() |
Returns the DOM document as an XML string.
|
DOMHandle |
with(org.w3c.dom.Document content) |
Assigns a DOM document as the content and returns the handle
as a fluent convenience.
|
DOMHandle |
withMimetype(java.lang.String mimetype) |
Specifies the mime type of the content and returns the handle
as a fluent convenience.
|
void |
write(java.io.OutputStream out) |
Implements a callback to write content to the provided output stream
for sending to the database server.
|
getByteLength, getFormat, getMimetype, getServerTimestamp, setByteLength, setMimetype, setServerTimestamppublic DOMHandle()
public DOMHandle(org.w3c.dom.Document content)
content - a DOM documentpublic static ContentHandleFactory newFactory()
public org.w3c.dom.ls.LSResourceResolver getResolver()
public void setResolver(org.w3c.dom.ls.LSResourceResolver resolver)
resolver - the reference resolverpublic org.w3c.dom.Document get()
get in interface ContentHandle<org.w3c.dom.Document>public void set(org.w3c.dom.Document content)
set in interface ContentHandle<org.w3c.dom.Document>content - a DOM documentpublic DOMHandle with(org.w3c.dom.Document content)
content - a DOM documentpublic void setFormat(Format format)
setFormat in interface ContentDescriptorsetFormat in class BaseHandle<java.io.InputStream,OutputStreamSender>format - the format of the contentpublic DOMHandle withMimetype(java.lang.String mimetype)
mimetype - the mime type of the contentpublic void fromBuffer(byte[] buffer)
BufferableHandlefromBuffer in interface BufferableHandlebuffer - the byte arraypublic byte[] toBuffer()
BufferableHandletoBuffer in interface BufferableHandlepublic java.lang.String toString()
toString in class java.lang.Objectpublic javax.xml.parsers.DocumentBuilderFactory getFactory()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException - if it occurs while initializing the new factorypublic void setFactory(javax.xml.parsers.DocumentBuilderFactory factory)
factory - the document factoryprotected javax.xml.parsers.DocumentBuilderFactory makeDocumentBuilderFactory()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationExceptionpublic javax.xml.xpath.XPath getXPathProcessor()
EditableNamespaceContextpublic void setXPathProcessor(javax.xml.xpath.XPath xpathProcessor)
xpathProcessor - the XPath expression processorprotected javax.xml.xpath.XPathFactory makeXPathProcessorFactory()
public <T> T evaluateXPath(java.lang.String xpathExpression,
java.lang.Class<T> as)
throws javax.xml.xpath.XPathExpressionException
T - the type to returnxpathExpression - the XPath expression as a stringas - the type expected to be matched by the xpathjavax.xml.xpath.XPathExpressionException - if xpathExpression cannot be evaluatedpublic <T> T evaluateXPath(java.lang.String xpathExpression,
org.w3c.dom.Node context,
java.lang.Class<T> as)
throws javax.xml.xpath.XPathExpressionException
T - the type to returnxpathExpression - the XPath expression as a stringcontext - the node for evaluating the expressionas - the type expected to be matched by the xpathjavax.xml.xpath.XPathExpressionException - if xpathExpression cannot be evaluatedpublic javax.xml.xpath.XPathExpression compileXPath(java.lang.String xpathExpression)
throws javax.xml.xpath.XPathExpressionException
xpathExpression - the XPath expression as a stringjavax.xml.xpath.XPathExpressionException - if xpathExpression cannot be compiledpublic <T> T evaluateXPath(javax.xml.xpath.XPathExpression xpathExpression,
java.lang.Class<T> as)
throws javax.xml.xpath.XPathExpressionException
T - the type to returnxpathExpression - an XPath expression compiled previouslyas - the type expected to be matched by the xpathjavax.xml.xpath.XPathExpressionException - if xpathExpression cannot be evaluatedpublic <T> T evaluateXPath(javax.xml.xpath.XPathExpression xpathExpression,
org.w3c.dom.Node context,
java.lang.Class<T> as)
throws javax.xml.xpath.XPathExpressionException
T - the type to returnxpathExpression - an XPath expression compiled previouslycontext - the node for evaluating the expressionas - the type expected to be matched by the xpathjavax.xml.xpath.XPathExpressionException - if xpathExpression cannot be evaluatedprotected void checkContext(org.w3c.dom.Node context)
protected javax.xml.namespace.QName returnXPathConstant(java.lang.Class<?> as)
protected <T> T castAs(java.lang.Object result,
java.lang.Class<?> as)
protected java.lang.Class<java.io.InputStream> receiveAs()
receiveAs in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>protected void receiveContent(java.io.InputStream content)
receiveContent in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>protected OutputStreamSender sendContent()
sendContent in class com.marklogic.client.impl.HandleImplementation<java.io.InputStream,OutputStreamSender>public void write(java.io.OutputStream out)
throws java.io.IOException
OutputStreamSenderwrite in interface OutputStreamSenderout - the output stream receiving the contentjava.io.IOException - if io problems ariseCopyright © 2013-2019 MarkLogic Corporation.