{"record":{"id":"ade693294de04d41","repo":"dianping/cat","slug":"xqst0088","errorCode":"XQST0088","errorMessage":"empty target namespace in module import or module declaration","messagePattern":"empty target namespace in module import or module declaration","errorType":"error_code","errorClass":"StaticError","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/editor/worker-xquery.js","lineNumber":1804,"sourceCode":"                    }\n                } catch(e) {\n                    throw new StaticError('XQST0059', 'module \"' + uri + '\" not found', pos);\n                }\n            }\n            return this;\n        },\n        getAvailableModuleNamespaces: function(){\n            return this.root.availableModuleNamespaces;\n        },\n        getPrefixByNamespace: function(uri){\n            return this.root.namespaces[uri].prefix;\n        },\n        addNamespace: function (uri, prefix, pos, type) {\n            if(prefix === '' && type === 'module') {\n                throw new StaticWarning('W01', 'Avoid this type of import. Use import module namespace instead', pos);\n            }\n            if (uri === '') {\n                throw new StaticError('XQST0088', 'empty target namespace in module import or module declaration', pos);\n            }\n            var namespace = this.getNamespace(uri);\n            if (namespace && namespace.type === type && type !== 'declare' && !namespace.override) {\n                throw new StaticError('XQST0047', '\"' + uri + '\": duplicate target namespace', pos);\n            }\n            namespace = this.getNamespaceByPrefix(prefix);\n            if (namespace && !namespace.override) {\n                throw new StaticError('XQST0033', '\"' + prefix + '\": namespace prefix already bound to \"' + namespace.uri + '\"', pos);\n            }\n\n            namespace = this.namespaces[uri];\n            this.namespaces[uri] = {\n                prefix: prefix,\n                pos: pos,\n                type: type\n            };\n\n            if (namespace) {","sourceCodeStart":1786,"sourceCodeEnd":1822,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/editor/worker-xquery.js#L1786-L1822","documentation":"XQST0088 is the standard XQuery error for an empty target namespace in a module import or module declaration. addNamespace() raises it whenever uri === '' — a module boundary (import or 'module namespace ...') must name a non-empty namespace URI, because module components are addressed by namespace.","triggerScenarios":"addNamespace('', prefix, pos, type) — e.g. 'import module namespace p = \"\";' or 'module namespace \"\";' after prefix/QName expansion produced an empty URI.","commonSituations":"Copy-paste imports where the URI string was deleted; templates with placeholder quotes; queries built by string concatenation where the namespace variable is undefined/empty.","solutions":["Fill in a real, absolute namespace URI in the import/declaration.","If the query is generated, validate that the namespace variable is non-empty before emitting the import.","Distinguish module imports from schema imports — only module boundaries require a target namespace here."],"exampleFix":"// before\nmodule namespace \"\";\n\n// after\nmodule namespace util = \"http://example.org/xquery/util\";","handlingStrategy":"validation","validationCode":"// Ensure generated prologs never emit an empty target namespace\nif (moduleUri === undefined || moduleUri === '') {\n  throw new Error('moduleUri required for module import: ' + moduleName);\n}","typeGuard":"function isNonEmptyNamespace(uri) {\n  return typeof uri === 'string' && uri.trim().length > 0;\n}","tryCatchPattern":"if (e.code === 'XQST0088') {\n  highlight(e.pos, 'Module import/declaration needs a non-empty namespace URI');\n}","preventionTips":["For generated XQuery, unit-test that every emitted import has a non-empty URI.","Treat empty template placeholders ('') as build errors before shipping queries."],"tags":["xquery","namespace","module-import","validation"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}