XQuery Function Documentation
http://exist-db.org/xquery/xmldb
java:org.exist.xquery.functions.xmldb.XMLDBModule
A module for database manipulation functions.
xmldb:add-user-to-group
Add a user to a group. $user is the username. $group is the group nameThe XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
- Parameters:
-
$user The user name $group The group name - Returns:
- xs:boolean : true() or false() indicating the outcome of the operation
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:add-group-member' instead! This function could be removed in the next major release version.
xmldb:authenticate
Check if the user, $user-id, can authenticate against the database collection $collection-uri. The function simply tries to read the collection $collection-uri, using the credentials $user-id and $password. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise.
- Parameters:
-
$collection-uri The collection URI $user-id? The user-id $password? The password - Returns:
- xs:boolean : true() on successful authentication, false() otherwise
xmldb:change-user
Change properties of an existing database user. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships, The username, $user-id, is mandatory. Non-empty values for the other parameters are optional, where if empty the existing value is used.
- Parameters:
-
$user-id The user-id $password? The password $groups* The groups the user is member of - Returns:
- item()
- Deprecated:
- Use either sm:passwd for changing a password or sm:add-group-member to add a user to a group or sm:remove-group-member to remove a user from a group. This function could be removed in the next major release version.
xmldb:change-user
Change properties of an existing database user. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships, $home-collection is the home collection. The username, $user-id, is mandatory. Non-empty values for the other parameters are optional, where if empty the existing value is used.
- Parameters:
-
$user-id The user-id $password? The password $groups* The groups the user is member of $home-collection? The user's home collection - Returns:
- item()
- Deprecated:
- $home-collection has no effect since 2.0. Use either sm:passwd for changing a password or sm:add-group-member to add a user to a group or sm:remove-group-member to remove a user from a group. This function could be removed in the next major release version.
xmldb:chmod-collection
Sets the mode of collection $collection. $mode is the mode as xs:integer. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
- Parameters:
-
$collection The collection path $mode The mode as xs:integer - Returns:
- item()
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:chmod' instead! This function could be removed in the next major release version.
xmldb:chmod-resource
Sets the mode of the resource $resource in collection $collection, $mode is the mode as xs:integer. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
- Parameters:
-
$collection The collection $resource The resource $mode The mode as xs:integer - Returns:
- item()
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:chmod' instead! This function could be removed in the next major release version.
xmldb:clear-lock
Returns the user-id of the user that holds a write lock on the resource $resource in the collection $collection-uri. If no lock is in place, the empty sequence is returned. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:string? : the user id of the lock owner, otherwise if not locked the empty sequence
xmldb:collection-available
Returns true() if the collection $collection-uri exists and is available, otherwise false(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:boolean : true() if the collection exists and is available, false() otherwise
xmldb:copy
Copy the collection $source-collection-uri to the collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$source-collection-uri The source collection URI $target-collection-uri The target collection URI - Returns:
- item()
xmldb:copy
Copy the resource $resource in $source-collection-uri to collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$source-collection-uri The source collection URI $target-collection-uri the target collection URI $resource the resource to copy - Returns:
- item()
xmldb:create-collection
Create a new collection with name $new-collection as a child of $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.Returns the path to the new collection if successfully created, otherwise the empty sequence.
- Parameters:
-
$target-collection-uri The target collection URI $new-collection The name of the new collection to create - Returns:
- xs:string? : the path to the new collection if successfully created, otherwise the empty sequence
xmldb:create-group
Create a new user group. $group is the group name. The current user will be the groups manager.
- Parameters:
-
$group The group name - Returns:
- xs:boolean : true() or false() indicating the outcome of the operation
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:create-group' instead! This function could be removed in the next major release version.
xmldb:create-group
Create a new user group, with an initial member. $group is the group name, $group-manager-username are the groups managers in addition to the current user.
- Parameters:
-
$group The group name $group-manager-username+ The name of the user(s) who will be the groups manager - Returns:
- xs:boolean : true() or false() indicating the outcome of the operation
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:create-group' instead! This function could be removed in the next major release version.
xmldb:create-user
Create a new user, $user-id, in the database. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships. The first group in the sequence is the primary group.Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$user-id The user-id $password The password $groups+ The group memberships - Returns:
- item()
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:create-account' instead! This function could be removed in the next major release version.
xmldb:create-user
Create a new user, $user-id, in the database. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships. The first group in the sequence is the primary group.$home-collection-uri is the home collection URI.Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$user-id The user-id $password The password $groups+ The group memberships $home-collection-uri? The home collection URI - Returns:
- item()
- Deprecated:
- $home-collection-uri has no effect since 2.0. You should use the sm:create-account function from the SecurityManager module instead. This function could be removed in the next major release version.
xmldb:created
Returns the creation date of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:dateTime : the creation date
xmldb:created
Returns the creation date of the resource $resource in $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:dateTime : the creation date
xmldb:decode
Decodes the string $string such that any percent encoded octets will be translated to their decoded UTF-8 representation.
- Parameters:
-
$string The input string - Returns:
- xs:string : the decoded string
xmldb:decode-uri
Decodes the URI $uri such that any percent encoded octets will be translated to their decoded UTF-8 representation.
- Parameters:
-
$uri The URI - Returns:
- xs:string : the decoded $uri as xs:string
xmldb:defragment
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
- Parameters:
-
$nodes+ The sequence of nodes from the documents to defragment - Returns:
- item()
xmldb:defragment
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. The second argument specifies the minimum number of fragmented pages which should be in a document before it is considered for defragmentation. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
- Parameters:
-
$nodes+ The sequence of nodes from the documents to defragment $integer The minimum number of fragmented pages required before defragmenting - Returns:
- item()
xmldb:delete-user
Deletes an existing user, $user-id, in the database. This does not delete the user's home collection. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role, and not being the owner of the currently running XQuery. You cannot delete the owner of the currently running XQuery.
- Parameters:
-
$user-id The user-id to delete - Returns:
- item()
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:remove-account' instead! This function could be removed in the next major release version.
xmldb:document
Returns the documents $document-uris in the input sequence. Collection URIs can be specified either as a simple collection path or an XMLDB URI.If the input sequence is empty, the function will load all documents in the database.
- Parameters:
-
$document-uris+ The document URIs - Returns:
- node()* : the documents
- Deprecated:
- See the standard fn:doc() function This function could be removed in the next major release version.
xmldb:document-has-lock
Returns the user-id of the user that holds a write lock on the resource $resource in the collection $collection-uri. If no lock is in place, the empty sequence is returned. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:string? : the user id of the lock owner, otherwise if not locked the empty sequence
xmldb:encode
Encodes the string $string such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements.
- Parameters:
-
$string The input string - Returns:
- xs:string : the URL encoded string
xmldb:encode-uri
Encodes the string $string such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements. Returns an xs:anyURI object representing a valid XmldbURI
- Parameters:
-
$string The input string - Returns:
- xs:anyURI : the XmldbURI encoded from $string
xmldb:exists-user
Returns true if the user $user-id exists.
- Parameters:
-
$user-id The user-id - Returns:
- xs:boolean : true() if the user exists, false() otherwise
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:user-exists' instead! This function could be removed in the next major release version.
xmldb:find-last-modified-since
Filters the given node set to only include nodes from resources which were modified since the specified date time.
- Parameters:
-
$node-set* A node set $since Date - Returns:
- node()? : the mime-type if available, otherwise the empty sequence
xmldb:get-child-collections
Returns the names of the child collections in the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:string* : the sequence of child collection names
xmldb:get-child-resources
Returns the names of the child resources in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:string* : the sequence of resource names
xmldb:get-current-user
Returns the user-id of the current user from the xquery context.
- Returns:
- xs:string : the user-id of the current user
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:id' instead! This function could be removed in the next major release version.
xmldb:get-current-user-attribute
Returns the attribute of the current user account.
- Parameters:
-
$name The name of the user attribute - Returns:
- xs:string? : the attribute value of the current user
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-account-metadata' instead! This function could be removed in the next major release version.
xmldb:get-current-user-attribute-names
Returns the names of the attributes of the current user.
- Returns:
- xs:string* : the attribute names of the current user
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-account-metadata-keys' instead! This function could be removed in the next major release version.
xmldb:get-group
Returns the owner group of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:string? : the owner group
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-group
Returns the owner group of the resource $resource in the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:string? : the owner group
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-mime-type
Returns the MIME type if available of the resource $resource-uri, otherwise the empty sequence. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
- Parameters:
-
$resource-uri The resource URI - Returns:
- xs:string? : the mime-type if available, otherwise the empty sequence
xmldb:get-owner
Returns the owner user-id of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:string? : the user-id
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-owner
Returns the owner user-id of the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:string? : the user-id
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-permissions
Returns the permissions assigned to the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection-uri - Returns:
- xs:int? : the collection permissions
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-permissions
Returns the permissions assigned to the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection-uri $resource The resource - Returns:
- xs:int? : the resource permissions
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-permissions' instead! This function could be removed in the next major release version.
xmldb:get-user-groups
Returns the sequence of groups the user $user-id is a member of.
- Parameters:
-
$user-id The user-id - Returns:
- xs:string+ : the group memberships
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-user-groups' instead! This function could be removed in the next major release version.
xmldb:get-user-home
Returns the user's home collection URI or the empty sequence if no home collection is assigned to the user $user-id.
- Parameters:
-
$user-id The user-id - Returns:
- xs:anyURI? : the home collection URI of user $user-id if one is assigned, otherwise the empty sequence
- Deprecated:
- Users do not have home collections since 2.0. Will return /db. This function could be removed in the next major release version.
xmldb:get-user-primary-group
Returns the user's primary group.
- Parameters:
-
$user-id The user-id - Returns:
- xs:string : The Primary Group of the User
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-user-primary-group' instead! This function could be removed in the next major release version.
xmldb:get-users
Returns the list of users in the group
- Parameters:
-
$group-name The group-name - Returns:
- xs:string* : The list of users in the group identified by $group-name
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:get-group-members' instead! This function could be removed in the next major release version.
xmldb:group-exists
Determines whether a group exists. $group is the group name, The current user must have permission to access the group, i.e. be a member of the group or DBA
- Parameters:
-
$group The group name - Returns:
- xs:boolean : true() or false() indicating the outcome of the operation
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:group-exists' instead! This function could be removed in the next major release version.
xmldb:is-admin-user
Returns true() if user $user-id has DBA role, false() otherwise.
- Parameters:
-
$user-id The user-id - Returns:
- xs:boolean? : true() if user has DBA role, false() otherwise
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:is-dba' instead! This function could be removed in the next major release version.
xmldb:is-authenticated
Returns the true() if current user from the xquery context is authenticated, false() otherwise.
- Returns:
- xs:boolean : true() if user from the xquery context is authenticated, false() otherwise
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:is-authenticated' instead! This function could be removed in the next major release version.
xmldb:last-modified
Returns the last-modification date of resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:dateTime? : the last modification date
xmldb:login
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQuery run in that session. If an HTTP session does not already exist, none will be created.
- Parameters:
-
$collection-uri The collection URI $user-id? The user-id $password? The password - Returns:
- xs:boolean : true() on successful authentication and owner elevation, false() otherwise
xmldb:login
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true() if the authentication succeeds, false() otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQueryrun in that session. $create-session specifies whether to create an HTTP session on successful authentication or not. If $create-session is false() or the empty sequence no session will be created if one does not already exist.
- Parameters:
-
$collection-uri The collection URI $user-id? The user-id $password? The password $create-session? whether to create the session or not on successful authentication, default false() - Returns:
- xs:boolean : true() on successful authentication and owner elevation, false() otherwise
xmldb:match-collection
Looks for collection names in the collection index that match the provided regexp
- Parameters:
-
$regexp The expression to use for matching collection names - Returns:
- xs:string* : The names of the collections that match the expression
xmldb:move
Moves the collection $source-collection-uri into the collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$source-collection-uri The source collection URI $target-collection-uri The target collection URI - Returns:
- item()
xmldb:move
Moves the resource $resource from the collection $source-collection-uri into collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$source-collection-uri The source collection URI $target-collection-uri The target collection URI $resource The resource - Returns:
- item()
xmldb:permissions-to-string
Formats the resource or collection permissions, $permissions, passed as an integer value into a string. The returned string shows the permissions following the Unix conventions, i.e. all permissions set is returned as rwxrwxrwx, where the first three chars are for user permissions, followed by group and other users. 'r' denotes read, 'w' write and 'u' update permissions.
- Parameters:
-
$permissions The permissions in xs:integer format - Returns:
- xs:string? : the permissions as string 'rwu' for, user, group and other
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:octal-to-mode' instead! This function could be removed in the next major release version.
xmldb:register-database
Registers an XMLDB driver class with the XMLDB Database Manager. This is only required if you want to access a database instance different from the one that executes the XQuery.
- Parameters:
-
$driver The DB driver $create-db The flag to create the db if it does not exist - Returns:
- xs:boolean : true() if successfully registered, false() otherwise
xmldb:reindex
Reindex collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
- Parameters:
-
$collection-uri The collection URI - Returns:
- xs:boolean : true() if successfully reindexed, false() otherwise
xmldb:remove
Removes the collection $collection-uri and its contents from the database. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI - Returns:
- item()
xmldb:remove
Removes the resource $resource from the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- item()
xmldb:remove-user-from-group
Remove a user from a group. $user is the username. $group is the group nameThe XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
- Parameters:
-
$user The user name $group The group name - Returns:
- xs:boolean : true() or false() indicating the outcome of the operation
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:remove-group-member' instead! This function could be removed in the next major release version.
xmldb:rename
Renames the collection $source-collection-uri with new name $new-collection-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$source-collection-uri The source collection URI $new-collection-name The new collection name - Returns:
- item()
xmldb:rename
Renames the resource $resource in collection $collection-uri with new name $new-resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource $new-resource-name The new resource name - Returns:
- item()
xmldb:set-collection-permissions
Sets the permissions of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $user-id specifies the user which will become the owner of the resource, $group-id the group, and $permissons the permissions as an xs:integer value. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
- Parameters:
-
$collection-uri The collection URI $user-id The user-id $group-id The group-id $permissions The permissions - Returns:
- item()
- Deprecated:
- You should use sm:chown and sm:chmod from the SecurityManager Module instead. This function could be removed in the next major release version.
xmldb:set-mime-type
Set the MIME type of the resource $resource-uri.Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
- Parameters:
-
$resource-uri The resource URI $mime-type? The new mime-type, use empty sequence to set default value. - Returns:
- empty()
xmldb:set-resource-permissions
Sets the permissions of the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $user-id specifies the user which will become the owner of the resource, $group-id the group, and $permissions the permissions as an xs:integer value. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
- Parameters:
-
$collection-uri The collection URI $resource The resource $user-id The user-id $group-id The group-id $permissions The permissions - Returns:
- item()
- Deprecated:
- You should use sm:chown and sm:chmod from the SecurityManager Module instead. This function could be removed in the next major release version.
xmldb:size
Returns the estimated size of the resource $resource (in bytes) in the collection $collection-uri. The estimation is based on the number of pages occupied by the resource. If the document is serialized back to a string, its size may be different, since parts of the structural information are stored in compressed form. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uri The collection URI $resource The resource - Returns:
- xs:long : the size of the pages, occupied by the resource, in bytes
xmldb:store
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If $contents is of type xs:anyURI, the resource is loaded from that URI. Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
- Parameters:
-
$collection-uri The collection URI $resource-name? The resource name $contents The contents - Returns:
- xs:string? : the path to new resource if sucessfully stored, otherwise the emtpty sequence
xmldb:store
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If $contents is of type xs:anyURI, the resource is loaded from that URI. The final argument $mime-type is used to specify a mime type. If the mime-type is not a xml based type, the resource will be stored as a binary resource.Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
- Parameters:
-
$collection-uri The collection URI $resource-name? The resource name $contents The contents $mime-type The mime type - Returns:
- xs:string? : the path to new resource if sucessfully stored, otherwise the emtpty sequence
xmldb:store-files-from-pattern
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
- Parameters:
-
$collection-uri The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $directory The directory in the file system from where the files are read. $pattern+ The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one - Returns:
- xs:string* : the sequence of document paths
xmldb:store-files-from-pattern
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
- Parameters:
-
$collection-uri The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $directory The directory in the file system from where the files are read. $pattern+ The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one $mime-type? If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. - Returns:
- xs:string* : the sequence of document paths
xmldb:store-files-from-pattern
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
- Parameters:
-
$collection-uri The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $directory The directory in the file system from where the files are read. $pattern+ The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one $mime-type? If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. $preserve-structure If preserve-structure is true(), the filesystem directory structure will be mirrored in the collection. Otherwise all the matching resources, including the ones in sub-directories, will be stored in the collection given in the first argument flatly. - Returns:
- xs:string* : the sequence of document paths
xmldb:store-files-from-pattern
Stores new resources into the database. Resources are read from the server's file system, using file patterns. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document(s).
- Parameters:
-
$collection-uri The collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $directory The directory in the file system from where the files are read. $pattern+ The file matching pattern. Based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one $mime-type? If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. $preserve-structure If preserve-structure is true(), the filesystem directory structure will be mirrored in the collection. Otherwise all the matching resources, including the ones in sub-directories, will be stored in the collection given in the first argument flatly. $exclude* A sequence of file patterns to exclude - Returns:
- xs:string* : the sequence of document paths
xmldb:string-to-permissions
Converts the resource or collection permissions, $permissions-string, into an integer representation suitable for use with set-permissions functions. The permissions string should be in the format 'rwxrwxrwx' where r is read, w is write and u is update.
- Parameters:
-
$permissions-string The permissions string - Returns:
- xs:integer : The permissions integer
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:mode-to-octal' instead! This function could be removed in the next major release version.
xmldb:update
Processes an XUpdate request, $modifications, against a collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.The modifications are passed in a document conforming to the XUpdate specification. http://rx4rdf.liminalzone.org/xupdate-wd.html#N1a32e0The function returns the number of modifications caused by the XUpdate.
- Parameters:
-
$collection-uri The collection URI $modifications The XUpdate modifications to be processed - Returns:
- xs:integer : the number of modifications, as xs:integer, caused by the XUpdate
xmldb:xcollection
Returns the document nodes in the collections $collection-uris non-recursively, i.e. does not include document nodes found in sub-collections. C.f. fn:collection(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
- Parameters:
-
$collection-uris+ The collection URIs - Returns:
- node()* : the document nodes from the specified collections excluding sub-collections