Last active
February 11, 2023 19:58
-
-
Save line-o/4896d177c5d9b429d08c81b24c3fda3c to your computer and use it in GitHub Desktop.
Illustrate a bug in existdb that leads to exist.log polluted with error messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script type="text/javascript"><![CDATA[ console.log(true && 1 < 2) ]]></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export EXISTDB_USER="admin" | |
export EXISTDB_PASS="" | |
# get this gist | |
git clone https://gist.github.com/line-o/4896d177c5d9b429d08c81b24c3fda3c test | |
# upload testfiles to local development instance | |
xst up test /db/apps/test | |
xst run "sm:chmod(xs:anyURI('/db/apps/test/traverse.xq'), 'o+x')" | |
# execute the test code | |
curl http://localhost:8080/exist/apps/test/traverse.xq | |
# inform what to do next | |
echo "now check exist.log for error messages" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "3.1"; | |
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; | |
declare option output:method "html"; | |
declare option output:html-version "5"; | |
declare option output:media-type "text/html"; | |
declare function local:traverse ($node as node()) { | |
typeswitch($node) | |
case document-node() return | |
$node/node() ! local:traverse(.) | |
case element() return | |
element { node-name($node) } { | |
$node/@*, | |
$node/node() ! local:traverse(.) | |
} | |
default return $node | |
}; | |
local:traverse(doc('has-cdata.html')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment