It's bad practice to pass input values to a query via string concatenation. That applies to SQL, and to XQuery. Use an external variable instead.
A quick search didn't turn up a good example in .NET, but you should be able to make sense of the Java code at http://docs.marklogic.com/4.2doc/xcc/javadoc/overview-summary_html.xhtml - look for the section titled "Passing Variables With Queries". You won't be able to pass a bytestream directly to an external variable, though. You will have to convert it to a string (perhaps in Base64 format) and pass that string to the query. Inside the query, you can convert the string to a binary node (perhaps using xs:base64Binary) for the pdf-convert function. It might help to take a look at http://marklogic.markmail.org/search/?q=base64binary -- Mike On 20 Jan 2011, at 23:44 , Santhosh Raj wrote: > > Dear All > > I am getting a pdf as byte array through my .NET webservices. I want to > convert it to the xml using xdmp:pdf-convert API of Marklogic executing > through Adhoc query.But It is not accepting byte array as input. > please let me know the options to covert this byte array so as to convert > pdf into xml > > I am posting my .NET code sample for reference > > public string ConvertPdftoXml(byte[] pdfAsStream) > { > try > { > > string transformQry = "xdmp:pdf-convert("; > transformQry = transformQry + pdfAsStream + ", > OutputXml.xml)"; > Request request = session.NewAdhocQuery(transformQry); > ResultSequence rs = session.SubmitRequest(request); > session.Close(); > return rs.AsString(); > > } > catch (Exception ex) > { > throw ex; > } > } > > > thanks in advance > > Santhosh Rajasekaran > Tata Consultancy Services > Mailto: [email protected] > Website: http://www.tcs.com > ____________________________________________ > Experience certainty. IT Services > Business Solutions > Outsourcing > ____________________________________________ > =====-----=====-----===== > 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://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
