Puneet Pant
Puneet Pant

Reputation: 1048

How to parse ">" and "<" in Xquery in Marklogic?

I want to use > and < in my xqy pages in Marklogic Server. But Marklogic converts > to &gt; and < to &lt; In Query Console also when I write > and run the query it prints the output as &gt; but I want it to be > only and not &gt;. How can I do this ?

Upvotes: 2

Views: 356

Answers (1)

grtjn
grtjn

Reputation: 20414

In QConsole you can select the Text output format. If you do so with a query that only contains ">", than only a > will be output. If you select the XML output format, it will be escaped and wrapped in a result element by the QConsole eval function to make it well-formed.

If you are checking your xqy page using a common web browser, it could be escaping properly written results too, make sure to check page source.

Note also that Marklogic returns xquery output usually as text/xml. You can set the response content type to text/plain using xdmp:set-response-content-type("text/plain")

HTH

Upvotes: 7

Related Questions