简体   繁体   中英

XQuery: Two namespaces in the same module?

Is it possible to declare 2 namespaces and group 2 diferent group of functions in those, and then import them in the same main script?

eg: Something like this in the main script

    import module namespace i = "UtilIntegers" at "Utils.xqm";
    import module namespace s = "UtilStrings" at "Utils.xqm";

Documentation is very ambiguous and implementation-dependant: http://www.xquery.com/tutorials/guided-tour/external-functions-variables.html

There are many aspects of module import that are indeed implementation-defined, but a library module can only have one target namespace (because it can only contain one ModuleDecl), and the rules are explicit:

The name of every variable and function declared in a library module must have a namespace URI that is the same as the target namespace of the module; otherwise a static error is raised [err:XQST0048].

In your example, one of the "import module" declarations is going to fail because the namespace appearing in the "import module" does not match the target namespace of the module being imported.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM