|
| 1 | +(: |
| 2 | + : eXist-db Open Source Native XML Database |
| 3 | + : Copyright (C) 2001 The eXist-db Authors |
| 4 | + : |
| 5 | + |
| 6 | + : http://www.exist-db.org |
| 7 | + : |
| 8 | + : This library is free software; you can redistribute it and/or |
| 9 | + : modify it under the terms of the GNU Lesser General Public |
| 10 | + : License as published by the Free Software Foundation; either |
| 11 | + : version 2.1 of the License, or (at your option) any later version. |
| 12 | + : |
| 13 | + : This library is distributed in the hope that it will be useful, |
| 14 | + : but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | + : Lesser General Public License for more details. |
| 17 | + : |
| 18 | + : You should have received a copy of the GNU Lesser General Public |
| 19 | + : License along with this library; if not, write to the Free Software |
| 20 | + : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | + :) |
| 22 | +xquery version "3.1"; |
| 23 | + |
| 24 | +module namespace unbt = "http://exist-db.org/xquery/update/namespace-binding-test"; |
| 25 | + |
| 26 | +import module namespace xmldb = "http://exist-db.org/xquery/xmldb"; |
| 27 | + |
| 28 | +declare namespace test = "http://exist-db.org/xquery/xqsuite"; |
| 29 | +declare namespace myns = "http://www.foo.com"; |
| 30 | + |
| 31 | +declare %private variable $unbt:test := document { |
| 32 | + <x xmlns:myns="http://www.bar.com"> |
| 33 | + <z/> |
| 34 | + </x> |
| 35 | +}; |
| 36 | + |
| 37 | +declare |
| 38 | + %test:setup |
| 39 | +function unbt:setup() { |
| 40 | + let $xml := fn:parse-xml('<x xmlns:myns="http://www.bar.com"><z/></x>') |
| 41 | + return |
| 42 | + xmldb:store("/db", "namespace-binding-test-1.xml", $xml) |
| 43 | + , |
| 44 | + xmldb:store("/db", "namespace-binding-test-2.xml", $unbt:test) |
| 45 | +}; |
| 46 | + |
| 47 | +declare |
| 48 | + %test:teardown |
| 49 | +function unbt:teardown() { |
| 50 | + xmldb:remove("/db/namespace-binding-test-1.xml"), |
| 51 | + xmldb:remove("/db/namespace-binding-test-2.xml"), |
| 52 | +}; |
| 53 | + |
| 54 | +declare |
| 55 | + %test:assertError("XUDY0023") |
| 56 | +function unbt:insert-namespaced-attribute-1() { |
| 57 | + update insert attribute myns:baz { "qux" } into doc("/db/namespace-binding-test-1.xml")/x/z |
| 58 | +}; |
| 59 | + |
| 60 | +declare |
| 61 | + %test:assertError("XUDY0023") |
| 62 | +function unbt:insert-namespaced-attribute-2() { |
| 63 | + update insert attribute myns:baz { "qux" } into doc("/db/namespace-binding-test-2.xml")/x/z |
| 64 | +}; |
0 commit comments