You can use the text { } or binary { } or node constructors.
xdmp:document-insert will load the document according to the node kind of the
2nd parameter. For example, to store a text file with uri "notxml.xml", try
something like this:
xquery version "1.0-ml";
xdmp:document-insert("notxml.xml", text { "This is a text node." } );
xdmp:node-kind(doc("notxml.xml")/node())
=> text
xquery version "1.0-ml";
xdmp:document-insert("notxml.xml", binary { "deadbeef" } );
xdmp:node-kind(doc("notxml.xml")/node())
=> binary
-Danny
From: [email protected]
[mailto:[email protected]] On Behalf Of Santhosh Raj
Sent: Friday, September 04, 2009 7:46 AM
To: [email protected]
Subject: [MarkLogic Dev General] How to insert binary or text document using
xdmp:document-insert() function - reg.,
Hi all,
I have to store .txt or .doc,.pdf files in marklogic server using
xdmp:document-insert() function.
In the Marklogic built-in functions it is represented as following:
xdmp:document-insert(
$uri as xs:string,
$root as node(),
[$permissions as element(sec:permission)*],
[$collections as xs:string*],
[$quality as xs:int?],
[$forest-ids as xs:unsignedLong*]
) as empty-sequence()
$root : The root node. The root node can be one of XML format, binary (BLOB)
format, or text (CLOB) format.
Eg: If i want to store a .txt file (sample.txt) with content as "This is a
sample text document."
or
If i want to store a .doc file (sample.doc) with content as "This is a
sample word document"
then how do i construct the root node of binary(BLOB) format or text(CLOB)
format.
How can i insert the document(text/doc) to database.
Thanks and Regards,
Santhosh Rajasekaran
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general