Re: [MarkLogic Dev General] xsl:output, character maps and document-insert
Christopher, thank you for responding :-) I was experimenting with your suggestion (it worked) when Mary's response arrived. Mary, thank you for the information and workaround! It was surprising to find out the difference between writing back to the database and serializing. I assumed it would be serialized everywhere. Best, Mark - -- --- - - Mark Donoghue IEEE (732) 562-6045 m.donog...@ieee.org IEEE - Advancing Technology for Humanity On Wed, Nov 8, 2017 at 10:19 AM, Mary Holstege <mary.holst...@marklogic.com> wrote: > > Character maps apply to serializations. What gets stored in the database > isn't serialized: it is a data model instance, that isn't serialized > unless it is (a) rendered as output from a query (b) saved to disk or (c) > explicitly serialized as a string via xdmp:quote. > > There is a special pass-through that when a document is returned from XSLT > and returned as a result of the query, the XSLT serialization options will > be applied, but that only works within the context of a single query. > > Try this: force a serialization using xdmp:quote and saving the reparse of > that, e.g. > xdmp:document-insert("/my.xml", xdmp:unquote(xdmp:quote($doc)) ) > > I think that should work. Round-tripping a serialization/parse to/from > disk should also work, e.g. > xdmp:document-insert("/my.xml", xdmp:document-get("/tmp/my.xml", > xdmp:save("/tmp/my.xml",$doc))) > > Failing that, you'll need to do a manual sweep-replace yourself so that > the data model instance you save has the characters in it that you want. > > //Mary > > > On Tue, 07 Nov 2017 15:22:41 -0800, Mark Donoghue <m.donog...@ieee.org> > wrote: > > > Hi, > > > > > > I am running a query in the query console that retrieves a document from > > the > > database, invokes an XSLT and stores the result over the same document > > URI. > > > > > > The purpose of the XSLT is to unescape double-escaped character entities > > (i.e.: > > amp;). Following what I thought was standard practice, the XSLT > > replaces &'s > > with and uses a character map to swap the private character > > with an > > ampersand on output (using the use-character-maps on the xsl:output > > element). > > > > > > This works fine in oXygen and even in the query console tests where I > > output the > > result document to the output pane. > > > > > > The problem occurs when I retrieve the document from the database. The > > private > > character is still in the result document I stored, and hasn't > > been > > replaced with an ampersand. > > > > > > Does document-insert (or something) ignore the xsl:output directives in > > the > > stylesheet? > > > > > > Am I running into some some query console behavior I'm not aware of (I'm > > still > > rather new at using MarkLogic). > > > > > > Any pointers in the right direction will he much appreciated. > > > > > > Best, > > > > Mark > > > > > > - -- --- - - > > Mark Donoghue > > > > IEEE > > > > (732) 562-6045 > > > > m.donog...@ieee.org > > > > > > IEEE - Advancing Technology for Humanity > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > ___ > General mailing list > General@developer.marklogic.com > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > ___ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
[MarkLogic Dev General] xsl:output, character maps and document-insert
Hi, I am running a query in the query console that retrieves a document from the database, invokes an XSLT and stores the result over the same document URI. The purpose of the XSLT is to unescape double-escaped character entities (i.e.: amp;). Following what I thought was standard practice, the XSLT replaces &'s with and uses a character map to swap the private character with an ampersand on output (using the use-character-maps on the xsl:output element). This works fine in oXygen and even in the query console tests where I output the result document to the output pane. The problem occurs when I retrieve the document from the database. The private character is still in the result document I stored, and hasn't been replaced with an ampersand. Does document-insert (or something) ignore the xsl:output directives in the stylesheet? Am I running into some some query console behavior I'm not aware of (I'm still rather new at using MarkLogic). Any pointers in the right direction will he much appreciated. Best, Mark - -- --- - ----- Mark Donoghue IEEE (732) 562-6045 m.donog...@ieee.org IEEE - Advancing Technology for Humanity ___ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
Re: [MarkLogic Dev General] Query Console error post upgrade 8 > 9
Still experiencing the error. I also see the error when accessing /qconsole/help.xqy but with a more verbose stack trace (see below). The gist is that is seems at some point the CSRF token is not getting to the application code because the error messages all report no value for it. It looks like the CSRF cookie is not being set in the browser. Even if I set the X-CSRF-Token header to the value I can find in the /security/token-storage.xml file. I set the header using Postman REST client (which gives the same error). I can see CSRF tokens getting stored in /security/token-storage.xml. I can delete this file and it gets re-generated. I can see a cookie named csrf-token-[port]-[user] with no value in Chrome Dev tools and Firefox Dev tools. I have cleared my browsing data from both chrome://settings and from Dev Tools. I have also set chrome to discard session data after shutdown and I don't have any restrictions on cookie-creation. At this point I feel like I'm missing something obvious. Thanks, Mark == http://marklogic.com/xdmp/error error.xsd" xmlns:error="http://marklogic.com/xdmp/error; xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance;> 2017-06-26 16:01:25.204 Info: SECURITY-BADREQUEST 2017-06-26 16:01:25.204 Info: err:FOER 2017-06-26 16:01:25.204 Info: 1.0-ml 2017-06-26 16:01:25.204 Info: SECURITY-BADREQUEST 2017-06-26 16:01:25.204 Info: SECURITY-BADREQUEST (err:FOER): Your session has been terminated by another login. Refresh Query Console to create a new session. 2017-06-26 16:01:25.204 Info: false 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: Your session has been terminated by another login. Refresh Query Console to create a new session. 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: /MarkLogic/appservices/qconsole/qconsole-security.xqy 2017-06-26 16:01:25.204 Info: 254 2017-06-26 16:01:25.204 Info: 14 2017-06-26 16:01:25.204 Info: sec:check-matching-csrf-token("") 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: http://marklogic.com/appservices/qconsole/security;>token 2017-06-26 16:01:25.204 Info: "" 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: http://marklogic.com/appservices/qconsole/security;>tk-uri 2017-06-26 16:01:25.204 Info: "/security/token-storage.xml" 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: http://marklogic.com/appservices/qconsole/security ">server-token 2017-06-26 16:01:25.204 Info: [REDACTED] 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 1.0-ml 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: /qconsole/help.xqy 2017-06-26 16:01:25.204 Info: 13 2017-06-26 16:01:25.204 Info: 2 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: _ 2017-06-26 16:01:25.204 Info: () 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: csrf 2017-06-26 16:01:25.204 Info: () 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 1.0-ml 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: 2017-06-26 16:01:25.204 Info: ====== - -- --- - - Mark Donoghue IEEE (732) 562-6045 m.donog...@ieee.org IEEE - Advancing Technology for Humanity On Thu, Jun 22, 2017 at 12:20 PM, Mark Donoghue <m.donog...@ieee.org> wrote: > I don't know if this is relevant, but my App-Services is running off port > 8008 (not 8000). I tried changing it to another port and I still get the > error. > > - -- --- - - > Mark Donoghue > IEEE > (732) 562-6045 > m.donog...@ieee.org > > IEEE - Advancing Technology for Humanity > > On Thu, Jun 22, 2017 at 11:08 AM, Dave Cassel <david.cas...@marklogic.com> > wrote: > >> There's an article in the Support team's Knowledge Base about this ( >> https://help.marklogic.com/Knowledgebase/Article/View/478/ >> 0/query-console-security-badrequest-invalid-csrf-token-error), but it >> sounds like you've already followed their recommendations. >> >> Anyone else have ideas? >> >> -- >> Dave Cassel, @dmcassel <https://twitter.com/dmcassel> >> Technical Community Manager >> MarkLogic Corporation <http://www.marklogic.com/> >> http://developer.marklogic.com/ >> >> From: <general-boun...@d
[MarkLogic Dev General] Query Console error post upgrade 8 > 9
Hi, I just upgraded my local (laptop) install of Marklogic 8 to 9.0-1.1. Now, when I attempt to access the query console I get the following error: == SECURITY-BADREQUEST (err:FOER): Your session has been terminated by another login. Refresh Query Console to create a new session. == Admin interface and Configuration Manager work fine. I have attempted the following: - Refreshed the browser (Chrome ver. 59.0.3071.109), and deleted browsing data. - Restarted my laptop several times. - Using Firefox (45.5.1) and get the same error message. - Created a new user with query-console permission (same error). - Changed the auth scheme from digest to basic, and back to digest. Chrome developer tools reports errors from the following resources: == jquery-1.7.min.js:4 GET http://localhost:8008/qconsole/endpoints/workspaces.xqy?cache=1498142153868 500 (SECURITY-BADREQUEST (err:FOER): Your session has been terminated by another login. Refresh Query Console to create a new session.) send @ jquery-1.7.min.js:4 == and == jquery-1.7.min.js:4 GET http://localhost:8008/qconsole/endpoints/sources.xqy?type=databases=1498142153871 500 (SECURITY-BADREQUEST (err:FOER): Your session has been terminated by another login. Refresh Query Console to create a new session.) == The only evidence of a similar error that I could find on the web refers to a tool named Roxy, which I'm not familiar with. It is also for version 8 of Marklogic. See: https://github.com/marklogic-community/roxy/issues/679 I am out of ideas. Has anyone else had this experience? Thanks, Mark - -- --- - - Mark Donoghue IEEE (732) 562-6045 m.donog...@ieee.org IEEE - Advancing Technology for Humanity ___ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general