Hi Santhosh, According to the Javadoc description < http://developer.marklogic.com/pubs/4.1/javadoc/com/marklogic/xcc/ContentFactory.html#newContent(java.lang.String,%20byte[],%20com.marklogic.xcc.ContentCreateOptions) >, the newContent function defaults to BINARY if the format is not set specifically in createOptions. So, you could spare yourself a few lines of code.. ;-)
But I think things are going wrong here, because your target uris might already exist with different data types. Once a document has been inserted as XML subsequent updates will automatically always be XML as well, ignoring any format specifications in the update statement. Can you check if these uris already exist? And if so, delete them from the database, and retry the insert.. Kind regards, Geert Drs. G.P.H. Josten Consultant <http://www.daidalos.nl/> Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 www.daidalos.nl<http://www.daidalos.nl/> KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Santhosh Raj Sent: zaterdag 12 september 2009 13:18 To: [email protected] Subject: [MarkLogic Dev General] Problem while inserting *.java and *.html file through XCC API from java- reg., Hi all, 1) Loading JAVA document. I am trying to load a java file (sample.java) from java using xcc api provided by marklogic. ContentCreateOptions createOptions = new ContentCreateOptions(); createOptions.setFormatText(); Content content = ContentFactory.newContent("sample.java", fileBytes, createOptions); xccSession.insertContent(content); // fileBytes - is the byte array constructed from the java file(sample.java). But it is giving com.marklogic.xcc.exceptions.XQueryException: XDMP-DOCROOTTEXT: Invalid root text (Exception) Note:If i load the same file using xdmp:document-load() function from cq it is loading fine. 2) Loading HTML document. When i load a html file using xcc api ContentCreateOptions createOptions = new ContentCreateOptions(); createOptions.setFormatText(); Content content = ContentFactory.newContent("sample.html", fileBytes, createOptions); xccSession.insertContent(content); If the html tag is not closed any where then it is throwing XDMP-DOCNOENDTAG:Expecting end tag com.marklogic.xcc.exceptions.XQueryException: XDMP-DOCNOENDTAG: Expecting end tag </link> at sample.html line 10 Note:If i load the same file using xdmp:document-load() function from cq it is loading fine. Please help me in this regard. How to tackle this problem. Thanks and Regard, 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
