Module xw
eXtraWay lua api
This library provides functions for eXtraWay server side scripting
Type xw
xw.addPackage(package) |
|
xw.authTriggersOff() |
|
xw.authTriggersOn() |
|
xw.calcDigest(alg, fileList) |
|
xw.callHttp(url, hdrMap, postMap, inBuff, proxy) |
|
xw.callLibrary(libraryName, funcName, parms) |
|
xw.callPlugIn(func, map) |
|
xw.callStoredProcedure(stored, map) |
|
xw.choose(bVal, trueVal, falseVal) |
|
xw.cloneRecord(record) |
|
xw.dumpRecord(record) |
|
xw.dumpString(str, ext) |
|
xw.encode(strng, inEnc, outEnc) |
|
xw.executeFastQuery(value, arc) |
|
xw.executeQuery(query, sortRule, arc) |
|
xw.export |
|
xw.fileBuffer(size, ext, name, trunc) |
|
xw.gcStep(steps) |
|
xw.getAttachmentFileName(attachId, arcName) |
|
xw.getCallStack() |
|
xw.getCurrentArcName() |
|
xw.getCurrentUserAndContext() |
|
xw.getNewAttachmentId(fileName, arcName) |
|
xw.getNewSerial(xPath, pattern, arcName) |
|
xw.getOs() |
|
xw.getPid() |
|
xw.getUserRights(user) |
|
xw.getXwDir() |
|
xw.getXwShareDir() |
|
xw.getXwTempDir() |
|
xw.invalidateUser(The) |
|
xw.isBusy(waitTime) |
|
xw.isDllCall() |
|
xw.isExiting() |
|
xw.isRunningEmbeded() |
|
xw.json |
|
xw.loadFirstRecordByFastQuery(value, arc) |
|
xw.loadFirstRecordByQuery(query, sortRule, arc) |
|
xw.loadRecordById(id, arc) |
|
xw.loadUniqueRecordByFastQuery(value, arc) |
|
xw.log |
|
xw.mail |
|
xw.map() |
|
xw.memBuffer() |
|
xw.methodInspector(inParms, outParms) |
|
xw.moduleName |
|
xw.moduleVersion |
|
xw.prepareRecord(txt, arc, num) |
|
xw.prepareRecordFromFile(file, archive) |
|
xw.prepareRecordFromStringBuffer(sb, archive) |
|
xw.prepareRecordSet(seleId, arc) |
|
xw.prepareVocabulary() |
|
xw.serialize |
|
xw.session |
|
xw.sleep(secs) |
|
xw.stringBuffer() |
|
xw.tableToMap(table) |
|
xw.triggersOff() |
|
xw.triggersOn() |
|
xw.unenvelop(record) |
|
xw.userHasRight(right, user) |
|
xw.utils |
|
Type xwLuaMap
xwLuaMap:clear() |
|
xwLuaMap:insert(key, val) |
|
xwLuaMap:isValid() |
|
Type xwLuaMemBuffer
xwLuaMemBuffer:append(val, valSize) |
|
xwLuaMemBuffer:appendString(val) |
|
xwLuaMemBuffer:getChunk() |
|
xwLuaMemBuffer:getPtr() |
|
xwLuaMemBuffer:isValid() |
|
xwLuaMemBuffer:toString() |
|
Type xwLuaNode
xwLuaNode:appendChild(name, value) |
|
xwLuaNode:appendChildNode(nodeToCopy, move) |
|
xwLuaNode:erase() |
|
xwLuaNode:getAttribute(name) |
|
xwLuaNode:getAttributes() |
|
xwLuaNode:getChildren(childType, sorted) |
|
xwLuaNode:getName() |
|
xwLuaNode:getRecord() |
|
xwLuaNode:getType() |
|
xwLuaNode:getValue() |
|
xwLuaNode:hasAttribute(name) |
|
xwLuaNode:hasAttributes() |
|
xwLuaNode:hasChildren() |
|
xwLuaNode:insertAfter(name, value) |
|
xwLuaNode:insertBefore(name, value) |
|
xwLuaNode:insertFirstChild(name, value) |
|
xwLuaNode:insertFirstChildNode(nodeToCopy, move) |
|
xwLuaNode:insertNodeAfter(nodeToCopy, move) |
|
xwLuaNode:insertNodeBefore(nodeToCopy, move) |
|
xwLuaNode:isValid() |
|
xwLuaNode:removeAttribute(name) |
|
xwLuaNode:rename() |
|
xwLuaNode:replace(toReplace) |
|
xwLuaNode:selectFirstNode(xpath) |
|
xwLuaNode:selectNodes(xpath) |
|
xwLuaNode:setAttribute(name, value, encoding) |
|
xwLuaNode:setValue(value, encoding) |
|
Type xwLuaNodeSet
xwLuaNodeSet:erase() |
|
xwLuaNodeSet:getAbsolute(num) |
|
xwLuaNodeSet:getCurrent() |
|
xwLuaNodeSet:getFirst() |
|
xwLuaNodeSet:getLast() |
|
xwLuaNodeSet:getNext() |
|
xwLuaNodeSet:getPrev() |
|
xwLuaNodeSet:isValid() |
|
Type xwLuaRecord
xwLuaRecord:applyXsl(xslt) |
|
xwLuaRecord:bintToArc(arc) |
|
xwLuaRecord:detach() |
|
xwLuaRecord:erase() |
|
xwLuaRecord:getArc() |
|
xwLuaRecord:getDetail(detailId) |
|
xwLuaRecord:getFirstNodeValue(xpath, node) |
|
xwLuaRecord:getId() |
|
xwLuaRecord:isValid() |
|
xwLuaRecord:lock(permanent) |
|
xwLuaRecord:reload() |
|
xwLuaRecord:save() |
|
xwLuaRecord:selectFirstNode(xpath, node) |
|
xwLuaRecord:selectNodes(xpath, node, sorted) |
|
xwLuaRecord:setContentFromRecord(The) |
|
xwLuaRecord:setContentFromString(The) |
|
xwLuaRecord:setNodeValue(xpath, node, value, encoding) |
|
xwLuaRecord:toString(skip) |
|
xwLuaRecord:unlock() |
|
Type xwLuaRecordSet
xwLuaRecordSet:getAbsolute(num, flags) |
|
xwLuaRecordSet:getAbsoluteTitle(num) |
|
xwLuaRecordSet:getCurrent(flags) |
|
xwLuaRecordSet:getCurrentTitle() |
|
xwLuaRecordSet:getFirst(flags) |
|
xwLuaRecordSet:getFirstTitle() |
|
xwLuaRecordSet:getId() |
|
xwLuaRecordSet:getLast(flags) |
|
xwLuaRecordSet:getLastTitle() |
|
xwLuaRecordSet:getNext(flags) |
|
xwLuaRecordSet:getNextTitle() |
|
xwLuaRecordSet:getPrev(flags) |
|
xwLuaRecordSet:getPrevTitle() |
|
xwLuaRecordSet:isValid() |
|
xwLuaRecordSet:refine(query, sortRule) |
|
xwLuaRecordSet:setTitleRule(titleRule) |
|
xwLuaRecordSet:sort(sortRule) |
|
Type xwLuaStringBuffer
xwLuaStringBuffer:append(val) |
|
xwLuaStringBuffer:getFileName() |
|
xwLuaStringBuffer:isValid() |
|
xwLuaStringBuffer:set(val) |
|
xwLuaStringBuffer:toFile(size, ext, fileName) |
|
xwLuaStringBuffer:toString() |
|
Type xwLuaVocabulary
xwLuaVocabulary:getFirst(flags) |
|
xwLuaVocabulary:getLast(flags) |
|
xwLuaVocabulary:getNext(flags) |
|
xwLuaVocabulary:getPrev(flags) |
|
xwLuaVocabulary:isValid() |
|
xwLuaVocabulary:setParam(theMap) |
|
Type xw
Field(s)
- xw.addPackage(package)
-
Load a package into the current Runner The package name is composed as follows: _logical-archive-id_ .
main-package-name [. sub-package-name [. sub-sub-package-name-and-so-on ] ]
The call can refer the logical archive name as * nothing: omitting the archive id causes the package to be loaded from the current one. * a valid name: this causes the package to be searched within the one declared for the given archive, then loaded. * the symbol '*': causes the package to be searched within the current archive and loaded if present, otherwise a package having the same name is loaded from the default system directory. * the symbol '$': causes the package to be loaded from the system default directory.
Parameter
#string package
: name.
Return value
#number:
- xw.authTriggersOff()
-
Switch off authoritative trigger execution.
This call only affects auth triggers. User triggers are left unchanged
Developer should pay attention to the usage of this method as well as of the <a href="##(xw).authTriggersOn">#xw.authTriggersOn</a>(). Switching a trigger Off takes effect on the lua function that calls this method and all the other that it calls. So if a called function calls again authTriggersOff() a counter is increased and the following call to authTriggersOn only changes the state of the counter. A called function, if it's not the first of the chain, could already have auth triggers switched Off and must take care to maintain a stable count of trigger usage. Triggers counter is available since version 1.5, previous versions have a single state on o off.
- xw.authTriggersOn()
-
Switch on authoritative trigger execution.
This call only affects auth triggers. User triggers are left unchanged.
See #authTriggersOff for details.
- xw.calcDigest(alg, fileList)
-
Evalutate the digest of a file list, respecting the list order.
Parameters
#string alg
: Algorithm to be used (sha1, other)#string fileList
: Comma separated list of file names to use
Return value
#string: The digest string evaluated
- xw.callHttp(url, hdrMap, postMap, inBuff, proxy)
-
Calls an HTTP Url using cURL and returns the result stored in a xwLuaMemBuffer_t
Parameters
#string url
: The Url to call#xwLuaMap hdrMap
: The map of headers to set#xwLuaMap postMap
: Tha map of POST parms to set#xwLuaMemBuffer inBuff
: The memory buffer that stores the packet content#string proxy
: The proxy host:port to use
Return value
#xwLuaMemBuffer: The memory buffer containing the response.
- xw.callLibrary(libraryName, funcName, parms)
-
Calls a Library function and returns a string containing the result.
If something wrong happens, an empty string is returnedParameters
#string libraryName
: Full or relative path and name (without extension) of the Library to load#string funcName
: Method to call#string parms
: The string containing all parameters
Return value
#string: The result
- xw.callPlugIn(func, map)
-
Calls a Plug-In Function and returns a string containing the result.
If something wrong happens, an empty string is returnedParameters
#string func
: The Plug In and Method (. ) full name. #xwLuaMap map
: The map containing each parameter name and parameter value, each of then in string format
Return value
#string: The result
- xw.callStoredProcedure(stored, map)
-
Calls a Stored procedure and returns a string containing the result.
If something wrong happens, an empty string is returnedParameters
#string stored
: The stored procedure full name. If the stored is concerning the current archive the first part, before the first dot, can be omitted#xwLuaMap map
: The map containing each parameter name and parameter value, each of then in string format
Return value
#string: The result
- xw.choose(bVal, trueVal, falseVal)
-
Evaluates the boolean expression given by <a href="bVal.html">bVal</a> and returns the expression corresponding to the true or false condition
Parameters
bVal
: The expression to evaluatetrueVal
: The result value if condition is truefalseVal
: The result value if condition is false
Return value
One of the two given values, trueVal or falseVal according to the expression evaluation
- xw.cloneRecord(record)
-
This function clones a record creating a new record (binded to the current arc).
Parameter
#xwLuaRecord record
: The record to clone
Return value
clonedRecord A new copy of the record, bound to the current archive.
--
- xw.dumpRecord(record)
-
Function to dump a record to file
Parameter
#xwLuaRecord record
: The record to dump
Return value
#string: The name of the temporary file
- xw.dumpString(str, ext)
-
Function to dump a string to file
Parameters
#string str
: The string to dump#string ext
: The estension of the file (txt is default)
Return value
#string: The name of the temporary file
- xw.encode(strng, inEnc, outEnc)
-
This method encodes differently a given string
Parameters
#string strng
: The string to recode#string inEnc
: The encoding of the original string#string outEnc
: The encogin required in output, if omitted "UTF-8" is assumed
Return value
const char * The recoded string
- xw.executeFastQuery(value, arc)
-
This method executes a faast query using just a search field and a search value
Parameters
#string value
: The value to search#string arc
: The logic ID of the archive to search on (if empty the current one is used)
Return value
#xwLuaRecordSet: The record set of identified record. Can be empty (that is, the record set is invalid)
- xw.executeQuery(query, sortRule, arc)
-
This method executes the required query expression
Parameters
#string query
: The query espression#string sortRule
: The sort rule. If empty no sort happens#string arc
: The logic ID of the archive to search on (if empty the current one is used)
Return value
#xwLuaRecordSet: The record set of identified record. Can be empty (that is, the record set is invalid)
- xw.export#xw.export xw.export
-
sub module export
- xw.fileBuffer(size, ext, name, trunc)
-
This method executes the required query expression
Parameters
#number size
: Size of the cache to fill before writing#string ext
: Required extension for the file.#string name
: Optional file name. If not given a temporary file will be created. Can be nil.#number trunc
: If the file name is given this option allows to append at the end when set to 0. 1 is default.
Return value
- xw.gcStep(steps)
-
Ask the Garbage Collection to ber performed for how may steps as defined (1 is default)
Parameter
#number steps
:Defines the gc steps to perform. If undefined (nil) the value 1 is used to declare a single gc step.
If the value is < 0 than a full gc is performed.
- xw.getAttachmentFileName(attachId, arcName)
-
Returns the attachment file name from the attachment Id
Parameters
#string attachId
: The attachment Id#string arcName
: The archive logic Id
Return value
#string: The attachment file name (full path)
- xw.getCallStack()
-
Returns the current call stach list
Return value
#string: The call stack methods list in JSON format
- xw.getCurrentArcName()
-
Returns the current archive name
Return value
#string: The current arc name (full path)
- xw.getCurrentUserAndContext()
-
Returns the current user Id and Context.
Context can be an empty string if not specified from the application.Return values
- #string: The Used Id
- #string: The actual Context
- xw.getNewAttachmentId(fileName, arcName)
-
Returns the new attachment Id from the attachment file name
Parameters
#string fileName
: The actual file name (full path must be provided)#string arcName
: The archive logic Id. If omitted the action will take place on the current archive.
Return value
#string: The attachment Id with extension.
- xw.getNewSerial(xPath, pattern, arcName)
-
Returns the next serial value for the given element/attribute.
The xPath must refer to a serial that is configured to be 'slack' so that serial value can be
used without regard to their progressiveness
Parameters
#string xPath
:The XPath of the element or attribute linked to a serial ID for which a new value is required.
This value can be also expressed as a 'search_alias' value, if any, the server will translate it properly.
#string pattern
:The serial pattern. If the required serial requires a prefix this should be the value of this string. In
any case the pattern can end with a 'dot' as required by the server, but if the dot is lost, eXtraWay acts as it's present at the end. So, if no prefix is required this parameter can be omitted or be an empty string.
#string arcName
: The archive name. If omitted the action will take place on the current archive.
Return values
- #string: serialValue The value assigned to the given serial path or an empty string if an error occur. The returned value is verified to be unique.
- #string: fullSerialValue If a prefix is provided, this is the composition of prefix and new Serial Value, otherwise it's an empty string.
- xw.getOs()
-
Returns a value telling the current OS
Return value
#number: The Os code (0=Windows; 1=Linux; 2=Solars; 3=Aix; 4=MacOS)
- xw.getPid()
-
Returns a value telling the current Process ID
Return value
#number: The Process ID
- xw.getUserRights(user)
-
Returns a <a href="##(table)">#table</a> containing each User Right
Parameter
#string user
: The user ID
Return value
#table: The User rights
- xw.getXwDir()
-
Returns the current eXtraWay binary directory
Return value
#string: The current eXtraWay binary directory (full path)
- xw.getXwShareDir()
-
Returns the current eXtraWay shared file directory
Return value
#string: The current eXtraWay shared directory (full path)
- xw.getXwTempDir()
-
Returns the current eXtraWay temporary file directory
Return value
#string: The current eXtraWay temporary directory (full path)
- xw.invalidateUser(The)
-
Invalidate the current user so that it's rights and configuration are reloaded
Parameter
#string The
: Used Id
- xw.isBusy(waitTime)
-
Tells the caller if the eXtraWay system is busy or, otherwise, if you can act since the service isn't used
Parameter
#number waitTime
: Amount of seconds to wait for the state to change in "not busy". If 'nil' or '0', the function doesn't wait at all.
Return value
#boolean: 'true' if the system is busy, false otherwise.
- xw.isDllCall()
-
Tells the calling function if this trigger/stored has been called within a generic or archive dependent Shared Library
- xw.isExiting()
-
Tells the caller if the eXtraWay system is going to exit
Return value
#boolean: 'true' if the system is going to exit, false otherwise.
- xw.isRunningEmbeded()
-
Tells the caller if the xw module is running in xw or stand alone
Return value
#boolean: 'true' if the system is running in xw, false otherwise.
- xw.json#xw.json xw.json
-
sub module json
- xw.loadFirstRecordByFastQuery(value, arc)
-
Execute a fast search and directly load the first record in it.
Correspond to #xw.executeFastQuery() followed by #xwLuaRecordSet.getFirst() on the resulting Record SetParameters
#string value
: The value to search for#string arc
: The Archive id to search on. Can be an empty string or nil to use the current archive.
Return value
- xw.loadFirstRecordByQuery(query, sortRule, arc)
-
Execute a search and directly load the first record in it.
Correspond to #xw.executeQuery() followed by #xwLuaRecordSet.getFirst() on the resulting Record SetParameters
#string query
: The Query expression to perform#string sortRule
: The sort rule to apply. Can be an empty string or nil to say no sort is required.#string arc
: The Archive id to search on. Can be an empty string or nil to use the current archive.
Return value
- xw.loadRecordById(id, arc)
-
Directly load a record knowing its physical ID.
Parameters
#number id
: The physical record number#string arc
: The Archive id to search on. Can be an empty string or nil to use the current archive.
Return value
- xw.loadUniqueRecordByFastQuery(value, arc)
-
Execute a fast search and directly load the first record in it if unique.
Correspond to #xw.executeFastQuery() followed by #xwLuaRecordSet.getFirst() on the resulting Record Set plus a unicity conditionParameters
#string value
: The value to search for#string arc
: The Archive id to search on. Can be an empty string or nil to use the current archive.
Return value
- xw.log#xw.log xw.log
-
sub module log
- xw.mail#xw.mail xw.mail
-
sub module mail
- xw.memBuffer()
-
Create a new xwLuaMemBuffer
Return value
- xw.methodInspector(inParms, outParms)
-
Function that builds a valid XML snippet containing information concerning stored procedures and triggers call and result parameters
Parameters
#table inParms
:#table outParms
:
Return value
#string: The XML snippet
- #string xw.moduleName
-
module name
- #table xw.moduleVersion
-
module version
- xw.prepareRecord(txt, arc, num)
-
Create xwLuaRecord resource, which is xw DOM of record.
Parameters
#string txt
: xml string to be parsed#string arc
: archive name (empty means current)#number num
: record phisical number (empty means unassigned)
Return value
- xw.prepareRecordFromFile(file, archive)
-
Create xwLuaRecord resource, which is xw DOM of record.
Parameters
#string file
: name to be parsed#string archive
: name (empty means current)
Return value
- xw.prepareRecordFromStringBuffer(sb, archive)
-
Create xwLuaRecord resource, which is xw DOM of record.
Parameters
#xwLuaStringBuffer sb
: buffer to be parsed#string archive
: name (empty means current)
Return value
- xw.prepareRecordSet(seleId, arc)
-
Create a Record Set starting from a selection Id (no search is done)
Parameters
#string seleId
: The selection id#string arc
: Name of the archive the selection belongs to. If omitted the current one is used
Return value
- xw.prepareVocabulary()
-
Create a new xwLuavocabulary
Return value
- xw.serialize#xw.serialize xw.serialize
-
sub module serialize
- xw.session#xw.session xw.session
-
sub module session
- xw.sleep(secs)
-
Hangs on for given senconds
Parameter
#number secs
: Amount of seconds to wait.
- xw.stringBuffer()
-
Create a new xwLuaStringBuffer
Return value
- xw.tableToMap(table)
-
Converts a lua table into a <a href="##(xwLuaMap)">#xwLuaMap</a>
Parameter
#table table
: The table to convert
Return value
#xwLuaMap: map The converted map
- xw.triggersOff()
-
Switch off trigger execution.
This call only affects user triggers. Authorization triggers are left unchanged.
Developer should pay attention to the usage of this method as well as of the <a href="##(xw).triggersOn">#xw.triggersOn</a>(). Switching a trigger Off takes effect on the lua function that calls this method and all the other that it calls. So if a called function calls again triggersOff() a counter is increased and the following call to triggersOn only changes the state of the counter. A called function, if it's not the first of the chain, could already have triggers switched Off and must take care to maintain a stable count of trigger usage. Triggers counter is available since version 1.5, previous versions have a single state on o off.
- xw.triggersOn()
-
Switch on trigger execution.
This call only affects user triggers. Authorization triggers are left unchanged.
See #triggersOff for details.
- xw.unenvelop(record)
-
Identifies the main record node even if the information unit is inside a response envelope Returns the first /Response/Document element or returns the root element if not found
Parameter
#xwLuaRecord record
: The original XML record
Return value
The root node for this record, skipping it's envelope
- xw.userHasRight(right, user)
-
Returns a boolean value telling if the given user has the given right label.
Parameters
#string right
: The right to check for#string user
: The user to check the right on. Can be nil/omitted so that the current user is checked.
Return value
#boolean: 'true' if the user has the required right, 'false' in any other case.
- xw.utils#xw.utils xw.utils
-
sub module utils
Type xwLuaMap
Associateve Maps
Field(s)
- xwLuaMap:clear()
-
Clears the content of the map
- xwLuaMap:insert(key, val)
-
Insert new data into the map If a value is already present for that key, the value is overwritten.
Both key and value must be set properly, no nil value is admittedParameters
#string key
: The key to use#string val
: The value to insert
- xwLuaMap:isValid()
-
Tells if the Map is valid or not
Return value
'true' if the String Buffer is valid, 'false' in any other case
Type xwLuaMemBuffer
Memory binary Buffers
Field(s)
- xwLuaMemBuffer:append(val, valSize)
-
Appends new binary data to the Mem Buffer
Parameters
#string val
: The value to append#number valSize
: The size of val
- xwLuaMemBuffer:appendString(val)
-
Appends new string data to the Mem Buffer
Parameter
#string val
: The value to append
- xwLuaMemBuffer:getChunk()
-
Returns a pointer to a part of the binary string
Return value
#string: The content
- xwLuaMemBuffer:getPtr()
-
Returns a pointer to the memory buffer
Return value
#string: The content
- xwLuaMemBuffer:isValid()
-
Tells if the MemBuffer is valid or not
Return value
'true' if the Mem Buffer is valid, 'false' in any other case
- xwLuaMemBuffer:toString()
-
Returns a pointer to the binary string This is a binary string since it's a lua string that can contain null values inside
Return value
#string: The content
Type xwLuaNode
e Xml node resource handle
Field(s)
- xwLuaNode:appendChild(name, value)
-
Inserts a new child element node as the last of all the children
Parameters
#string name
: The child Element name to create#string value
: The value to set into the created element
Return value
#xwLuaNode: The created node
- xwLuaNode:appendChildNode(nodeToCopy, move)
-
Inserts a new child element node as the last of all children
Parameters
#string nodeToCopy
: The not to insert#boolean move
: If true the node to copy is moved into the required position
Return value
#xwLuaNode: The created node
- xwLuaNode:erase()
-
Removes the current node
Return value
#number: Non 0 if the node is removed
- xwLuaNode:getAttribute(name)
-
Returns the value of the attribute named 'name' on the current node.
If the attribute is not present an empty string is returned.Parameter
#string name
: The required attribute name
Return value
#string: The attribute value or an empty string. There's no way to know if the attribute is absent of simply has no value.
- xwLuaNode:getAttributes()
-
Selects all the attributes of the current node,
Return value
#xwLuaNodeSet: The set of selected attribute nodes
- xwLuaNode:getChildren(childType, sorted)
-
Selects all the child notes matching the given node type Available node types are: * 1: Elements * 2: Attributes * 3: Comments * 4: Processing Instructions * 5: Text * -1: All of the above
Parameters
#number childType
: The node type to search fom.#boolean sorted
: Tells if the child nodes must be sorted or not, default not sorted.
Return value
#xwLuaNodeSet: The set of selected nodes
- xwLuaNode:getName()
-
Returns the node name
Return value
#string: The node name
- xwLuaNode:getRecord()
-
Returns the xwLuaRecord this node belongs to
Return value
#xwLuaRecord: The xwLuaRecord this node belongs to (or nil)
- xwLuaNode:getType()
-
Returns the node type
Return value
#number: One of the following node types: 0(Unknown),1(Elements), 2(Attributes), 3(Comments), 4(Processing Instructions), 5(Text)
- xwLuaNode:getValue()
-
Returns the node value, no matter the node type
Return value
#string: The node value
- xwLuaNode:hasAttribute(name)
-
Tells if this node has the required attribute
Parameter
#string name
: The name of the attribute to look for. The function doesn't care if the attribute has a value or not
Return value
#boolean: true if required attribute is present, false in every other case.
- xwLuaNode:hasAttributes()
-
Tells if this node has attributes
Return value
#boolean: true if attribute nodes are present, false in every other case.
- xwLuaNode:hasChildren()
-
Tells if this node has children nodes
Return value
#boolean: true if children nodes are present (any type of node), false in every other case.
- xwLuaNode:insertAfter(name, value)
-
Inserts a new element node after the current one setting it's name and value
Parameters
#string name
: The Element name to create#string value
: The value to set into the created element
Return value
#xwLuaNode: The created node
- xwLuaNode:insertBefore(name, value)
-
Inserts a new element node before the current one setting it's name and value
Parameters
#string name
: The Element name to create#string value
: The value to set into the created element
Return value
#xwLuaNode: The created node
- xwLuaNode:insertFirstChild(name, value)
-
Inserts a new child element node as the first of all the children
Parameters
#string name
: The child Element name to create#string value
: The value to set into the created element
Return value
#xwLuaNode: The created node
- xwLuaNode:insertFirstChildNode(nodeToCopy, move)
-
Inserts a new child element node as the first of all children
Parameters
#string nodeToCopy
: The not to insert#boolean move
: If true the node to copy is moved into the required position
Return value
#xwLuaNode: The created node
- xwLuaNode:insertNodeAfter(nodeToCopy, move)
-
Inserts a new element node after the current one
Parameters
#string nodeToCopy
: The not to insert#boolean move
: If true the node to copy is moved into the required position
Return value
#xwLuaNode: The created node
- xwLuaNode:insertNodeBefore(nodeToCopy, move)
-
Inserts a new element node before the current one
Parameters
#string nodeToCopy
: The not to insert#boolean move
: If true the node to copy is moved into the required position
Return value
#xwLuaNode: The created node
- xwLuaNode:isValid()
-
Checks validity of node
Return value
#boolean:
- xwLuaNode:removeAttribute(name)
-
Removes the named attribute
Parameter
#string name
: The name of the attribute to remove
Return value
#boolean: true if the node is removed, false in any other case
- xwLuaNode:rename()
-
Changes the name of the current node.
It actually performs an insertion and deletion of the node and all childrens
- xwLuaNode:replace(toReplace)
-
Substitute the current node with another one.
PAY GREAT ATTENTION: the used node is invalid after this call. You should use the returned one as the valid node so please avoid...
node:replace(toReplace) ...and use... node = node:replace(toReplace)
Parameter
#xwLuaNode toReplace
: The node to replace the current one with
Return value
#xwLuaNode: The replaced (new) node
- xwLuaNode:selectFirstNode(xpath)
-
Selects the first node matching the given xPath starting from the current node.
Performs xwRecord#selectnodes() with the current node and choose the first one.Parameter
#string xpath
: The XPath to match
Return value
#xwLuaNode: The first node of the set of selected nodes
- xwLuaNode:selectNodes(xpath)
-
Selects nodes matching the given xPath starting from the current node.
Performs xwRecord#selectnodes() with the current node.Parameter
#string xpath
: The XPath to match
Return value
#xwLuaNodeSet: The set of selected nodes
- xwLuaNode:setAttribute(name, value, encoding)
-
Sets the attribute value (creates the attribute if absent)
Parameters
#string name
: The name of the attribute to set#string value
: The value to set#string encoding
: The encoding in which value is expressed
Return value
#boolean: true if the node is set, false in any other case
- xwLuaNode:setValue(value, encoding)
-
Set the node value, no matter which is the type of node
Parameters
#string value
: The value to set#string encoding
: The encoding in which value is espressed
Return value
#number: Non 0 if the operation is successful, 0 in any other case
Type xwLuaNodeSet
Xml nodes set resource handle
Field(s)
- xwLuaNodeSet:erase()
-
Removes from the DOM from which the NodeSet has been evaluate every node contained into the Node Set.
Also deeper nodes (child nodes) of the one into the Node Set are removed.Return value
#number: 0 if the deletion of nodes doesn't take completely place, non 0 in case of correctness
- xwLuaNodeSet:getAbsolute(num)
-
Returns a xwLuaNode from the current Node Set.
If the operation Node Set is empty or the given position is over the end of the Node Set, the returned node is invalid.
Position must be between 1 and the size of the Node Set
Parameter
#number num
: The absolute position to reach, between 1 and the size of the Node Set
Return value
- xwLuaNodeSet:getCurrent()
-
Returns (again) the current xwLuaNode of the current Node Set.
It assumes that a previous call to #xwLuaNodeSet.getFirst/#xwLuaNodeSet.getLast()/#xwLuaNodeSet.getAbsolute() has been performed.
If the operation Node Set is empty or no position call has previously been performed, the returned node is invalid.
Return value
- xwLuaNodeSet:getFirst()
-
Returns the first xwLuaNode of the current Node Set.
If the Node Set is empty, the returned node is invalid.Return value
- xwLuaNodeSet:getLast()
-
Returns the last xwLuaNode of the current Node Set.
If the operation Node Set is empty, the returned node is invalid.Return value
- xwLuaNodeSet:getNext()
-
Returns the next xwLuaNode of the current Node Set.
It assumes that a previous call to #xwLuaNodeSet.getFirst/#xwLuaNodeSet.getLast()/#xwLuaNodeSet.getAbsolute() has been performed.
If the operation goes over the Node Set size, the returned node is invalid.
Return value
- xwLuaNodeSet:getPrev()
-
Returns the previous xwLuaNode of the current Node Set.
It assumes that a previous call to #xwLuaNodeSet.getFirst/#xwLuaNodeSet.getLast()/#xwLuaNodeSet.getAbsolute() has been performed.
If the operation goes over the beginning of Node Set size, the returned node is invalid.
Return value
- xwLuaNodeSet:isValid()
-
Checks validity of node set
Return value
#boolean:
Type xwLuaRecord
Xml record DOM resource handle
Field(s)
- xwLuaRecord:applyXsl(xslt)
-
Apply xslt transformation to current record.
Produces a stringBufferParameter
#xwLuaRecord xslt
: The record containing the xslt to be appyed
Return value
#xwLuaStringBuffer: The string buffer that contains the result.
- xwLuaRecord:bintToArc(arc)
-
When a record is created (see <a href="xw.html##(prepareRecord)">xw#prepareRecord</a>()) it belongs to the current archive.
To bind a record to another archive use this method.Parameter
#string arc
: The logical name of the archive to bind to
Return value
#number: 1 in case of success, 0 in any other case.
- xwLuaRecord:detach()
-
Each record is bound to an archive, the current one or the one you chosen.
A new record is not linked to an existing record into that archive while a record that's been loaded after
a search operation is linked to the archive record. This record detaches an existing record loaded from an archive and make it as brand new, useful when you want to create a new copy of this record to save it as new.
Return value
#number: 1 in case of success, 0 in any other case.
- xwLuaRecord:erase()
-
Removes a previously loaded record.
Only fails if the record has been already removed.
- xwLuaRecord:getArc()
-
Returns the archive name the record is bound to
Return value
#string: The archive name the record is bound to
- xwLuaRecord:getDetail(detailId)
-
Returns a detail (meta data) concerning the actual record Available values are: * _ndoc_: Phisical record number * _NRecord_: The same than 'ndoc' but 0 filled * _FileName_: The phisical file name the record belongs to * _FileDate_ and _FileTime_: Date and time of the file * _DateIns_ and _TimeIns_: Date and time the record has been created * _DateMod_ and _TimeMod_: Date and time the record has been modified last time
Parameter
#string detailId
: The string that identifies the required detail.
Return value
#string: The archive name the record is bound to
- xwLuaRecord:getFirstNodeValue(xpath, node)
-
Evaluates the XPath, matches the first node and returns the node value, no matter if it's an element, attribute and so on.
Helps getting directly to a single value without having to deal with xwLuaNodeSet.
See also <a href="##(xwLuaNode).getFirstNodeValue">#xwLuaNode.getFirstNodeValue</a>()
Parameters
#string xpath
: The XPath to evaluate#xwLuaNode node
: The xwLuaNode to start from (makes the XPath relative). Can be nil.
Return value
#string: The value of first node matching the given XPath. There's no guaranty that it's the only one.
- xwLuaRecord:getId()
-
Returns the physical record Id in order to use that value to load a record from scratch without having to search for it
Return value
#number: The physical record number.
- xwLuaRecord:isValid()
-
Checks validity of record
Return value
#boolean:
- xwLuaRecord:lock(permanent)
-
Locks (and reload) the xwLuaRecord and prepares it to be modified and saved.
Parameter
#boolean permanent
: Let the locking survive to script exiting.
Return value
#boolean: True if the record has been locked, false otherwise.
- xwLuaRecord:reload()
-
Performs a reload of the current record in order to refresh record content if it's been changed by somebody else.
This is also done from lock() method.
- xwLuaRecord:save()
-
Performs a save of the current record.
Can be called on new record or on existing ones. For existing records
it's strongly recomended to perform a <a href="lock.html">lock</a>() before or the saving operation could fail due to an optimistic lock.
Return value
#number: The phisic record number of the record saved.
- xwLuaRecord:selectFirstNode(xpath, node)
-
Evaluates the XPath and returns the first xwLuaNode matching it.
Helps getting directly to a single objective without having to deal with xwLuaNodeSet.
See also <a href="xwLuaNode.html##(getFirstNodeValue)">xwLuaNode#getFirstNodeValue</a>()
Parameters
#string xpath
: The XPath to evaluate#xwLuaNode node
: The xwLuaNode to start from (makes the XPath relative). Can be nil.
Return value
#xwLuaNode: The first node matching the given XPath. There's no guaranty that it's the only one.
- xwLuaRecord:selectNodes(xpath, node, sorted)
-
Evaluates xpath expression and returns <a href="xwLuaNodeSet.html">xwLuaNodeSet</a>
Parameters
#string xpath
: xPath expression#xwLuaNode node
: context node for xPath#number sorted
: Requires ordered result if non 0.
Return value
- xwLuaRecord:setContentFromRecord(The)
-
Sets the value of the record from another record.
See also xwLuaRecord#setContentFromString() that uses an input string instead.Parameter
#xwLuaRecord The
: record to use to clone it's content into the current one
- xwLuaRecord:setContentFromString(The)
-
Sets the value of the record from a string record.
See also xwLuaRecord#setContentFromRecord() that uses an input xwLuaRecord instead.Parameter
#string The
: string to use to set the record's content
- xwLuaRecord:setNodeValue(xpath, node, value, encoding)
-
Evaluates the XPath and for all nodes matching it sets a new value
Parameters
#string xpath
: The XPath to evaluate#xwLuaNode node
: The xwLuaNode to start from (makes the XPath relative). Can be nil.#string value
: The value to set.#string encoding
: The encoding in which value is espressed
Return value
#number: The number of nodes changed
- xwLuaRecord:toString(skip)
-
Dumps Dom xml into string
Parameter
#boolean skip
: Tells the method if it's required to skip XML header
Return value
#string:
- xwLuaRecord:unlock()
-
Unlocks the record.
After unlocking the record could be saved with save() with optimistic lock but saving is
not guaranteed.
Type xwLuaRecordSet
The Xml record set resource handle
Field(s)
- xwLuaRecordSet:getAbsolute(num, flags)
-
Returns the xwLuaRecord having the absolute position num within the current Record Set.
No previous call are required.
If the Record Set is empty or the required position doesn't match with a valid record, the returned record is invalid. Provided index must be between 1 and the size of recordSet.
Parameters
#number num
: The absolute position to reach, between 1 and the size of the Record Set#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getAbsoluteTitle(num)
-
Returns the title of the record having the absolute position num within the current Record Set.
No previous call are required.
If the Record Set is empty or the required position doesn't match with a valid record, the returned title is nil. Provided index must be between 1 and the size of recordSet.
Parameter
#number num
: The absolute position to reach, between 1 and the size of the Record Set
Return values
- #string:
- #number: The record Id
- xwLuaRecordSet:getCurrent(flags)
-
Returns (again) the current xwLuaRecord of the current Record Set.
Assumes that a positioning call has been performed previously.
If the Record Set is empty or no valid position is actually set, the returned record is invalid.
Parameter
#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getCurrentTitle()
-
Returns (again) the title of current record of the current Record Set.
Assumes that a positioning call has been performed previously.
If the Record Set is empty or no valid position is actually set, the returned title is nil.
Return values
- #string:
- #number: The record Id
- xwLuaRecordSet:getFirst(flags)
-
Returns the first xwLuaRecord of the current Record Set.
If the Record Set is empty, the returned record is invalid.
A 'flag' value can be set putting one or more of this values in "or" * 2: High Light the selected document * 4: Call the archive Shared Library on load.
Parameter
#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getFirstTitle()
-
Returns the first title of the current Record Set.
If the Record Set is empty, the returned title is nil.Return values
- #string: The title
- #number: The record Id
- xwLuaRecordSet:getId()
-
Returns the record Set ID to be used in eXtraWay (as for refining or other activities) Since Ver.
1.1.1Return value
#string: The Record Set ID
- xwLuaRecordSet:getLast(flags)
-
Returns the last xwLuaRecord of the current Record Set.
If the Record Set is empty, the returned record is invalid.Parameter
#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getLastTitle()
-
Returns the title of last record of the current Record Set.
If the Record Set is empty, the returned title is nil.Return values
- #string:
- #number: The record Id
- xwLuaRecordSet:getNext(flags)
-
Returns the next xwLuaRecord of the current Record Set.
Requires that at least a getFirst()/getLast() call has been done previously.
If the Record Set contains no mode records, the returned record is invalid.
Parameter
#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getNextTitle()
-
Returns the title of the next record of the current Record Set.
Requires that at least a getFirst()/getLast() call (or corresponding method on titles) has been done previously.
If the Record Set contains no mode records, the returned title is nil.
Return values
- #string: The title
- #number: The record Id
- xwLuaRecordSet:getPrev(flags)
-
Returns the previous xwLuaRecord of the current Record Set.
Requires that at least a #xwLuaRecordSet.getFirst()/#xwLuaRecordSet.getLast()/#xwLuaRecordSet.getAbsolute() call has been done previously.
If the Record Set can't be moved before it's beginning, the returned record is invalid.
Parameter
#number flags
: Used to perform special activities
Return value
- xwLuaRecordSet:getPrevTitle()
-
Returns the title of the previous record of the current Record Set.
Requires that at least a #xwLuaRecordSet.getFirst()/#xwLuaRecordSet.getLast()/#xwLuaRecordSet.getAbsolute() call (or corresponding calls on titles) has been done previously.
If the Record Set can't be moved before it's beginning, the returned title is nil.
Return values
- #string:
- #number: The record Id
- xwLuaRecordSet:isValid()
-
Checks validity of record set
Return value
#boolean:
- xwLuaRecordSet:refine(query, sortRule)
-
Returns a new xwLuaRecordSet performing a filtering of the current one with the required new selection.
Parameters
#string query
: The query expression to perform to filter the current Record Set#string sortRule
: The sort rule to apply. Can be nil.
Return value
- xwLuaRecordSet:setTitleRule(titleRule)
-
Set the title rule that will be used in future calls to <a href="getFirstTitle.html">getFirstTitle</a>() and others...
Parameter
#string titleRule
: The title rule to apply.
- xwLuaRecordSet:sort(sortRule)
-
Simply performs a sort upon an existing Record Set and returns a new sorted one
Parameter
#string sortRule
: The sort rule to apply.
Return value
Type xwLuaStringBuffer
String and File Buffers
Field(s)
- xwLuaStringBuffer:append(val)
-
Appends new data to the String Buffer
Parameter
#string val
: The value to append
- xwLuaStringBuffer:getFileName()
-
Returns the file name that has been used or will be used to dump the String Buffer into a file
Return value
#string: The file name
- xwLuaStringBuffer:isValid()
-
Tells if the StringBuffer is valid or not
Return value
'true' if the String Buffer is valid, 'false' in any other case
- xwLuaStringBuffer:set(val)
-
Removes any content from the String Buffer and sets a new value in it
Parameter
#string val
: The value set
- xwLuaStringBuffer:toFile(size, ext, fileName)
-
Ensure the StringBuffer content is dumped into a file.
Parameters
#number size
: The maximum dimension of the data to cache in memory before every write operation. If not set the default is used#string ext
: The file extension to use. If not set the file will have no extension.#string fileName
: The full name of the file. If not provided a temporary one will be automatically used
- xwLuaStringBuffer:toString()
-
Dumps the content of the String Buffer into a single, complete lua string
Return value
#string: The content
Type xwLuaVocabulary
a Vocabulary resource handle
Field(s)
- xwLuaVocabulary:getFirst(flags)
-
Returns the first xwLuaVocabulary value of the current Vocabulary shed.
If the Vocabulary shed is empty, the returned string is invalid.
Function provides a flag for future suage
Parameter
#number flags
: Used to perform special activities
Return values
- #string: key The String containing the required key
- #number: freq The frequency for that key according to limits
- xwLuaVocabulary:getLast(flags)
-
Loads in the Vocabulary shed all keys available according to limits (see setParam) Calling this function is normally not required (is automatically called if required during First/Next/Prev/Last calls) but can be done in order to perform the size evaluation of the shed (that is not available until the load is done, manually or automatically).
Parameter
#number flags
: Used to perform special activities
Return values
- #string: key The String containing the required key
- #number: freq The frequency for that key according to limits
- xwLuaVocabulary:getNext(flags)
-
Returns the next xwLuaVocabulary value of the current Vocabulary shed.
Requires that at least a getFirst()/getLast() call has been done previously.
If the Vocabulary shed contains no mode keys, the returned string is invalid.
Parameter
#number flags
: Used to perform special activities
Return values
- #string: key The String containing the required key
- #number: freq The frequency for that key according to limits
- xwLuaVocabulary:getPrev(flags)
-
Returns the previous xwLuaVocabulary value of the current Vocabulary shed.
Requires that at least a #xwLuaVocabulary.getFirst()/#xwLuaVocabulary.getLast() call has been done previously.
If the Vocabulary shed can't be moved before it's beginning, the returned string is invalid.
Parameter
#number flags
: Used to perform special activities
Return values
- #string: key The String containing the required key
- #number: freq The frequency for that key according to limits
- xwLuaVocabulary:isValid()
-
Checks validity of Vocabulary
Return value
#boolean:
- xwLuaVocabulary:setParam(theMap)
-
Allows to define parameters that will condition the keys loaded within the Vocabulary shed.
This function can be called more than once and all new parameters overwrite existing ones. Existing
parameters that are not overwritten will remain unchanged. Each time this function is called, the loaded Vocabulary shed will be invalidated (and loaded again).
Parameter
#xwLuaMap theMap
: A xwLuaMap of parameters to set