Kari,
There are two different issues with your code that are causing problems.
First off, any time in XQuery that you return two or more XML nodes as part of a
sequence within parentheses (as opposed to part of a full XML tree structure),
they need to be comma separated just like any other items in a sequence. So just
as you need to say
return ( "a", "b")
you need to say
return ( <?instruction here?>, <element>my element</element> )
with a comma.
BUT: "<?xml version="1.0" encoding="UTF-8"?>" is not a processing instruction,
it is an XML declaration, and you can't include it as part of a simple sequence.
This will throw an error:
(
<?xml version="1.0" encoding="UTF-8"?>,
<doc><p>text</p></doc>
)
In order to output the XML declaration, wrap your XML inside the XQuery document
constructor, like so:
if ($returnRSS) then
document {
<rss> ... </rss>
}
and the output will include "<?xml version="1.0" encoding="UTF-8"?>".
If you need to change the default serialization options (for example, to change
character encoding, or to indent output), see
http://docs.marklogic.com/guide/xquery/langoverview#id_71572
David S.
On Thu, 28 Jan 2016, Kari Cowan wrote:
I may be going about this wrong, but I was trying to insert the xml marker
above an RSS feed return:
<?xml version="1.0" encoding="UTF-8"?>
Returns error> [1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax
error, unexpected Version_, expecting Comma_ or Rpar_ or SemiColon_
Seems like a common thing that would be desired, but my websearch didn't find
the answer. Any tips here?
if ($returnRSS) then (
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sailthru="http://www.sailthru.com/rss-extension">
<channel>
<title>{$this_partner} Events RSS</title>
<description>See Upcoming Events presented by {$this_partner} </description>
<link>http://www/need/to/map/a/path/to/event/hubpage</link>
{$outputRSS}
</channel>
</rss>
)
--
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400318, Charlottesville, VA 22904-4314 USA
Email: [email protected] Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general