HI all,
I need to add properties of the content using xcc API.
Which API to use, a sample code will be useful.
To add the properties I have constructed an xQuery and calling
xccSession.newAdhocQuery() method.
I have the properties xml String in java, so while passing the
value to the xdmp:document-set-properties()
method I am doing xdmp:unquote() , While doing unquote if the
incoming content has the character "&"
then it is giving an error.
I have tried the sample with cq tool also it is also giving the
same error.
XQUERY:
xquery version "1.0-ml";
xdmp:document-set-properties("/company_home/Platts/RichMedia/g.jpg",<properties>{xdmp:unquote("<a>a
& b </a><a>a </a>")}</properties>)
EXCEPTION MESSAGE:
[1.0-ml] XDMP-DOCENTITYREF: xdmp:unquote("<a>a & b </a><a>a </a>") --
Invalid entity reference " " at line 1
Stack trace:
line 2:
1: xquery version "1.0-ml";
2:
xdmp:document-set-properties("/company_home/Platts/RichMedia/g.jpg",<properties>{xdmp:unquote("<a>a
& b </a><a>a </a>")}</properties>)
3:
4: (:
xdmp:document-set-properties("/company_home/Platts/RichMedia/g.jpg",<properties><a>a
& b </a><a>a </a></properties>) :)
xdmp:eval("xquery version "1.0-ml";
xdmp:document-set-p...", (), <options
xmlns="xdmp:eval"><database>11311277076057227957</database><modules>68553168501560...</options>)
in /cq/eval.xqy line 111:
JAVA CODE:
/**
* Set the properties to an existing document/directory in the
marklogic database.
* @param xccSession - session Object used to connect
to marklogic server.
* @param uri - uri of the document present in
the marklogic server to which the properties
* should
be set.
* @param properties - String representation of the
properties element.
* Eg:
<properties> <property name="author"> <value>TCS
</value></property></properties>
* @throws RequestException
*/
public void setProperty(Session xccSession,String uri,String
properties) throws RequestException {
LOGGER.info("Adding property to the document: "+ uri);
StringBuffer sb = new StringBuffer();
sb.append("xdmp:document-set-properties('" +uri +
"',<properties>{xdmp:unquote('"+ properties +"')}</properties>)");
LOGGER.debug("Property set query:" + sb.toString());
Request request = xccSession.newAdhocQuery
(sb.toString());
xccSession.submitRequest (request);
LOGGER.info("Property added successfully to the document:
"+ uri);
}
Please suggest what to do?
Thanks & 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