Erik, You're workaround works, at least in my browser. I did need to add Mike's suggestion of omitting the xml output declaration, however. I will have to run some tests with our client applications, but so far so good!
-Will -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Erik Hennum Sent: Thursday, November 15, 2012 3:53 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] REST API doctype extension Hi, Will: I don't think the problem here is specific to the REST API. Instead, the challenge is constructing a document node that contains an expression declaring the document type. I checked the XQuery 3.0 recommendation http://www.w3.org/TR/xquery-30/#id-documentConstructors but didn't find anything about document type expressions. One workaround would be to serialize the document as text in your extension: document { text{ "<!DOCTYPE ...>", xdmp:quote(<doc/>) } } You'd still parse it as XML on the client side. Anyone have a better approach for the document constructor? Hoping that's useful, Erik Hennum ________________________________________ From: [email protected] [[email protected]] On Behalf Of Will Thompson [[email protected]] Sent: Thursday, November 15, 2012 3:20 PM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] REST API doctype extension We are trying to extend the REST API to return doctypes for some documents. Part of the problem seems to be with the required function signature for GET: document-node()*. This obviously throws a coercion exception when the return value is ('<!DOCTYPE ... >', document{ <doc/> }). So I tried returning nesting the doctype under the document node: document { ('<!DOCTYPE ... >',<doc/>) } - this doesn't throw the exception, but it looks like another one gets caught somewhere, and the page renders a pretty error message: "This page contains the following errors: error on line 2 at column 1: Document is empty Below is a rendering of the page up to the first error." The rest of the page is empty. Any suggestions on a good way to do this? Thanks, Will _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
