From: <ix...@us...> - 2009-07-31 02:42:30
|
Revision: 9594 http://exist.svn.sourceforge.net/exist/?rev=9594&view=rev Author: ixitar Date: 2009-07-31 02:42:17 +0000 (Fri, 31 Jul 2009) Log Message: ----------- [documentation] enhancing function module documentation. Modified Paths: -------------- trunk/eXist/src/org/exist/xquery/functions/FunLocalName.java trunk/eXist/src/org/exist/xquery/functions/FunMatches.java trunk/eXist/src/org/exist/xquery/functions/FunMax.java trunk/eXist/src/org/exist/xquery/functions/FunMin.java trunk/eXist/src/org/exist/xquery/functions/FunName.java trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURI.java trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURIForPrefix.java trunk/eXist/src/org/exist/xquery/functions/FunNilled.java Modified: trunk/eXist/src/org/exist/xquery/functions/FunLocalName.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunLocalName.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunLocalName.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -1,5 +1,5 @@ /* eXist Open Source Native XML Database - * Copyright (C) 2000-2006, the eXist team + * Copyright (C) 2000-2009, the eXist team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -28,6 +28,8 @@ import org.exist.xquery.Profiler; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; @@ -41,23 +43,36 @@ * */ public class FunLocalName extends Function { + + protected static final String FUNCTION_DESCRIPTION = + "Returns the local part of the name of $arg as an xs:string that " + + "will either be the zero-length string or will have the lexical form of an xs:NCName.\n\n" + + "If the argument is omitted, it defaults to the context item (.). " + + "The behavior of the function if the argument is omitted is exactly " + + "the same as if the context item had been passed as the argument.\n\n" + + "The following errors may be raised: if the context item is undefined " + + "[err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.\n\n" + + "If the argument is supplied and is the empty sequence, the function " + + "returns the zero-length string.\n\n" + + "If the target node has no name (that is, if it is a document node, a " + + "comment, or a text node), the function returns the zero-length string.\n\n" + + "Otherwise, the value returned will be the local part of the expanded-QName " + + "of the target node (as determined by the dm:node-name accessor in Section " + + "5.11 node-name AccessorDM. This will be an xs:string whose lexical form is an xs:NCName." ; + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("local-name", Function.BUILTIN_FUNCTION_NS), - "Returns the local part of the name of the context item as an xs:string " + - "that will either be the zero-length string or will have the lexical " + - "form of an xs:NCName.", + FUNCTION_DESCRIPTION, new SequenceType[0], - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) + new FunctionReturnSequenceType(Type.STRING, Cardinality.EXACTLY_ONE, "the local name") ), new FunctionSignature( new QName("local-name", Function.BUILTIN_FUNCTION_NS), - "Returns the local part of the name of the value of $a as an xs:string " + - "that will either be the zero-length string or will have the lexical " + - "form of an xs:NCName.", - new SequenceType[] { new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) }, - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) + FUNCTION_DESCRIPTION, + new SequenceType[] { new FunctionParameterSequenceType("arg", Type.NODE, Cardinality.ZERO_OR_ONE, "") }, + new FunctionReturnSequenceType(Type.STRING, Cardinality.EXACTLY_ONE, "the local name") ) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunMatches.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunMatches.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunMatches.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -1,6 +1,6 @@ /* * eXist Open Source Native XML Database - * Copyright (C) 2001-06 Wolfgang M. Meier + * Copyright (C) 2001-09 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * @@ -37,6 +37,8 @@ import org.exist.xquery.util.RegexTranslator; import org.exist.xquery.util.RegexTranslator.RegexSyntaxException; import org.exist.xquery.value.BooleanValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; @@ -57,31 +59,45 @@ */ public class FunMatches extends Function implements Optimizable, IndexUseReporter { + protected static final String FUNCTION_DESCRIPTION = + "The function returns true if $input matches the regular expression " + + "supplied as $pattern as influenced by the value of $flags, if present; " + + "otherwise, it returns false.\n\n" + + "The effect of calling the first version of this function (omitting the " + + "argument $flags) is the same as the effect of calling the second version " + + "with the $flags argument set to a zero-length string. " + + "Flags are defined in 7.6.1.1 Flags.\n\n" + + "If $input is the empty sequence, it is interpreted as the zero-length string.\n\n" + + "Unless the metacharacters ^ and $ are used as anchors, the string is considered " + + "to match the pattern if any substring matches the pattern. But if anchors are used, " + + "the anchors must match the start/end of the string (in string mode), or the " + + "start/end of a line (in multiline mode).\n\n" + + "Note:\n\n" + + "This is different from the behavior of patterns in [XML Schema Part 2: Datatypes " + + "Second Edition], where regular expressions are implicitly anchored.\n\n" + + "Please note that - in contrast - with the " + + "specification - this method allows zero or more items for the string argument.\n\n" + + "An error is raised [err:FORX0002] if the value of $pattern is invalid " + + "according to the rules described in section 7.6.1 Regular Expression Syntax.\n\n" + + "An error is raised [err:FORX0001] if the value of $flags is invalid " + + "according to the rules described in section 7.6.1 Regular Expression Syntax."; + + protected static final FunctionParameterSequenceType INPUT_ARG = new FunctionParameterSequenceType("input", Type.STRING, Cardinality.ZERO_OR_MORE, "the input string"); + protected static final FunctionParameterSequenceType PATTERN_ARG = new FunctionParameterSequenceType("pattern", Type.STRING, Cardinality.EXACTLY_ONE, "the pattern"); + protected static final FunctionParameterSequenceType FLAGS_ARG = new FunctionParameterSequenceType("flags", Type.STRING, Cardinality.EXACTLY_ONE, ""); + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("matches", Function.BUILTIN_FUNCTION_NS), - "Returns true if the first argument string matches the regular expression specified " + - "by the second argument. This function is optimized internally if a range index of type xs:string " + - "is defined on the nodes passed to the first argument. Please note that - in contrast - with the " + - "specification - this method allows zero or more items for the string argument.", - new SequenceType[] { - new SequenceType(Type.STRING, Cardinality.ZERO_OR_MORE), - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) - }, - new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE) + FUNCTION_DESCRIPTION, + new SequenceType[] { INPUT_ARG, PATTERN_ARG }, + new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true if the pattern is a match") ), new FunctionSignature( new QName("matches", Function.BUILTIN_FUNCTION_NS), - "Returns true if the first argument string matches the regular expression specified " + - "by the second argument. This function is optimized internally if a range index of type xs:string " + - "is defined on the nodes passed to the first argument. Please note that - in contrast - with the " + - "specification - this method allows zero or more items for the string argument.", - new SequenceType[] { - new SequenceType(Type.STRING, Cardinality.ZERO_OR_MORE), - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE), - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) - }, - new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE) + FUNCTION_DESCRIPTION, + new SequenceType[] { INPUT_ARG, PATTERN_ARG, FLAGS_ARG }, + new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true if the pattern is a match") ) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunMax.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunMax.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunMax.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -37,6 +37,8 @@ import org.exist.xquery.value.ComputableValue; import org.exist.xquery.value.DoubleValue; import org.exist.xquery.value.FloatValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NumericValue; import org.exist.xquery.value.QNameValue; @@ -50,28 +52,57 @@ */ public class FunMax extends CollatingFunction { + protected static final String FUNCTION_DESCRIPTION = + "Selects an item from the input sequence $arg whose value is " + + "greater than or equal to the value of every other item in the " + + "input sequence. If there are two or more such items, then the " + + "specific item whose value is returned is implementation dependent.\n\n" + + "The following rules are applied to the input sequence:\n\n" + + "- Values of type xs:untypedAtomic in $arg are cast to xs:double.\n" + + "- Numeric and xs:anyURI values are converted to the least common " + + "type that supports the ge operator by a combination of type " + + "promotion and subtype substitution. See Section B.1 Type " + + "PromotionXP and Section B.2 Operator MappingXP.\n\n" + + "The items in the resulting sequence may be reordered in an arbitrary " + + "order. The resulting sequence is referred to below as the converted " + + "sequence. This function returns an item from the converted sequence " + + "rather than the input sequence.\n\n" + + "If the converted sequence is empty, the empty sequence is returned.\n\n" + + "All items in $arg must be numeric or derived from a single base type " + + "for which the ge operator is defined. In addition, the values in the " + + "sequence must have a total order. If date/time values do not have a " + + "timezone, they are considered to have the implicit timezone provided " + + "by the dynamic context for purposes of comparison. Duration values " + + "must either all be xs:yearMonthDuration values or must all be " + + "xs:dayTimeDuration values.\n\n" + + "If any of these conditions is not met, then a type error is raised [err:FORG0006].\n\n" + + "If the converted sequence contains the value NaN, the value NaN is returned.\n\n" + + "If the items in the value of $arg are of type xs:string or types " + + "derived by restriction from xs:string, then the determination of " + + "the item with the largest value is made according to the collation " + + "that is used. If the type of the items in $arg is not xs:string " + + "and $collation is specified, the collation is ignored.\n\n" + + "The collation used by the invocation of this function is " + + "determined according to the rules in 7.3.1 Collations."; + + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("max", Function.BUILTIN_FUNCTION_NS), - "Selects an item from the input sequence $a whose value " + - "is greater than or equal to the value of every other item in the " + - "input sequence.", + FUNCTION_DESCRIPTION, new SequenceType[] { - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_MORE) + new FunctionParameterSequenceType("arg", Type.ATOMIC, Cardinality.ZERO_OR_MORE, "") }, - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE) + new FunctionReturnSequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE, "the max value") ), new FunctionSignature( new QName("max", Function.BUILTIN_FUNCTION_NS), - "Selects an item from the input sequence $a whose value " + - "is greater than or equal to the value of every other item in the " + - "input sequence. The collation URI specified in $b will be used for " + - "string comparisons.", + FUNCTION_DESCRIPTION, new SequenceType[] { - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_MORE), - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) + new FunctionParameterSequenceType("arg", Type.ATOMIC, Cardinality.ZERO_OR_MORE, ""), + new FunctionParameterSequenceType("collation", Type.STRING, Cardinality.EXACTLY_ONE, "") }, - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE) + new FunctionReturnSequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE, "the max value") ) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunMin.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunMin.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunMin.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -1,6 +1,6 @@ /* * eXist Open Source Native XML Database - * Copyright (C) 2001-06 Wolfgang M. Meier + * Copyright (C) 2001-09 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * @@ -37,6 +37,8 @@ import org.exist.xquery.value.ComputableValue; import org.exist.xquery.value.DoubleValue; import org.exist.xquery.value.FloatValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NumericValue; import org.exist.xquery.value.QNameValue; @@ -50,24 +52,62 @@ */ public class FunMin extends CollatingFunction { + protected static final String FUNCTION_DESCRIPTION = + + "selects an item from the input sequence $arg whose value is " + + "less than or equal to the value of every other item in the " + + "input sequence. If there are two or more such items, then " + + "the specific item whose value is returned is implementation dependent.\n\n" + + "The following rules are applied to the input sequence:\n\n" + + "- Values of type xs:untypedAtomic in $arg are cast to xs:double.\n" + + "- Numeric and xs:anyURI values are converted to the least common " + + "type that supports the le operator by a combination of type promotion " + + "and subtype substitution. See Section B.1 Type PromotionXP and " + + "Section B.2 Operator MappingXP.\n\n" + + + "The items in the resulting sequence may be reordered in an arbitrary " + + "order. The resulting sequence is referred to below as the converted " + + "sequence. This function returns an item from the converted sequence " + + "rather than the input sequence.\n\n" + + + "If the converted sequence is empty, the empty sequence is returned.\n\n" + + + "All items in $arg must be numeric or derived from a single base type " + + "for which the le operator is defined. In addition, the values in the " + + "sequence must have a total order. If date/time values do not have a " + + "timezone, they are considered to have the implicit timezone provided " + + "by the dynamic context for the purpose of comparison. Duration values " + + "must either all be xs:yearMonthDuration values or must all be " + + "xs:dayTimeDuration values.\n\n" + + + "If any of these conditions is not met, a type error is raised [err:FORG0006].\n\n" + + + "If the converted sequence contains the value NaN, the value NaN is returned.\n\n" + + + "If the items in the value of $arg are of type xs:string or types derived " + + "by restriction from xs:string, then the determination of the item with " + + "the smallest value is made according to the collation that is used. If " + + "the type of the items in $arg is not xs:string and $collation is " + + "specified, the collation is ignored.\n\n" + + + "The collation used by the invocation of this function is determined " + + "according to the rules in 7.3.1 Collations."; + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("min", Function.BUILTIN_FUNCTION_NS), - "Selects an item from the input sequence $a whose value is less than or equal to " + - "the value of every other item in the input sequence.", - new SequenceType[] { new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_MORE)}, - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE) + FUNCTION_DESCRIPTION, + new SequenceType[] { new FunctionParameterSequenceType("arg", Type.ATOMIC, Cardinality.ZERO_OR_MORE, "")}, + new FunctionReturnSequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE, "the minimum value") ), new FunctionSignature( new QName("min", Function.BUILTIN_FUNCTION_NS), - "Selects an item from the input sequence $a whose value is less than or equal to " + - "the value of every other item in the input sequence. The collation specified in $b is " + - "used for string comparisons.", + FUNCTION_DESCRIPTION, new SequenceType[] { - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_MORE), - new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE) + new FunctionParameterSequenceType("arg", Type.ATOMIC, Cardinality.ZERO_OR_MORE, ""), + new FunctionParameterSequenceType("collation", Type.STRING, Cardinality.EXACTLY_ONE, "") }, - new SequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE) + new FunctionReturnSequenceType(Type.ATOMIC, Cardinality.ZERO_OR_ONE, "the minimum value") ) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunName.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunName.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunName.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -1,5 +1,5 @@ /* eXist Open Source Native XML Database - * Copyright (C) 2000-03, Wolfgang M. Meier (me...@if...) + * Copyright (C) 2000-09, Wolfgang M. Meier (me...@if...) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License @@ -29,6 +29,8 @@ import org.exist.xquery.Profiler; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; @@ -43,20 +45,39 @@ */ public class FunName extends Function { + protected static final String FUNCTION_DESCRIPTION = + + "Returns the name of a node, as an xs:string that is either " + + "the zero-length string, or has the lexical form of an xs:QName.\n\n" + + + "If the argument is omitted, it defaults to the context item (.). " + + "The behavior of the function if the argument is omitted is exactly " + + "the same as if the context item had been passed as the argument.\n\n" + + + "The following errors may be raised: if the context item is undefined " + + "[err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.\n\n" + + + "If the argument is supplied and is the empty sequence, the function " + + "returns the zero-length string.\n\n" + + + "If the target node has no name (that is, if it is a document node, a comment, " + + "a text node, or a namespace binding having no name), the function returns " + + "the zero-length string.\n\n" + + + "Otherwise, the value returned is fn:string(fn:node-name($arg))."; + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("name", Function.BUILTIN_FUNCTION_NS), - "Returns the name of a node, as an xs:string that is " + - "either the zero-length string, or has the lexical form of an xs:QName", + FUNCTION_DESCRIPTION, new SequenceType[0], - new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE) + new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "the name") ), new FunctionSignature( new QName("name", Function.BUILTIN_FUNCTION_NS), - "Returns the name of a node, as an xs:string that is " + - "either the zero-length string, or has the lexical form of an xs:QName", - new SequenceType[] { new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) }, - new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE) + FUNCTION_DESCRIPTION, + new SequenceType[] { new FunctionParameterSequenceType("arg", Type.NODE, Cardinality.ZERO_OR_ONE, "") }, + new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "the name") ) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURI.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURI.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURI.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -30,6 +30,8 @@ import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.AnyURIValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; @@ -43,26 +45,37 @@ */ public class FunNamespaceURI extends Function { + protected static final String FUNCTION_DESCRIPTION = + + "Returns the namespace URI of the xs:QName of $arg.\n\n" + + + "If the argument is omitted, it defaults to the context node (.). " + + "The behavior of the function if the argument is omitted is exactly " + + "the same as if the context item had been passed as the argument.\n\n" + + + "The following errors may be raised: if the context item is undefined " + + "[err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.\n\n" + + + "If $arg is neither an element nor an attribute node, or if it is an " + + "element or attribute node whose expanded-QName (as determined by the " + + "dm:node-name accessor in the Section 5.11 node-name AccessorDM) is " + + "in no namespace, then the function returns the xs:anyURI " + + "corresponding to the zero-length string."; + public final static FunctionSignature signatures[] = { new FunctionSignature( new QName("namespace-uri", Function.BUILTIN_FUNCTION_NS), - "Returns the namespace URI of the xs:QName of the context item. " + - "If the context item is in no namespace or is neither an element nor attribute node, " + - "returns the xs:anyURI equivalent to the zero-length string." + - " Raises an error if the context item is undefined or not a node.", + FUNCTION_DESCRIPTION, new SequenceType[0], - new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE), + new FunctionReturnSequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE, "the namespace URI"), false), new FunctionSignature( new QName("namespace-uri", Function.BUILTIN_FUNCTION_NS), - "Returns the namespace URI of the xs:QName value of $a. " + - "If $a is in no namespace or is neither an element nor attribute node, " + - "returns the xs:anyURI eqvivalent to the zero-length string." + - " Raises an error if the context item is undefined or not a node.", + FUNCTION_DESCRIPTION, new SequenceType[] { - new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) + new FunctionParameterSequenceType("arg", Type.NODE, Cardinality.ZERO_OR_ONE, "") }, - new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE), + new FunctionReturnSequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE, "the namespace URI"), false) }; Modified: trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURIForPrefix.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURIForPrefix.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunNamespaceURIForPrefix.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -1,6 +1,6 @@ /* * eXist Open Source Native XML Database - * Copyright (C) 2001-2008 The eXist Project + * Copyright (C) 2001-2009 The eXist Project * http://exist-db.org * * This program is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.AnyURIValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; @@ -47,20 +49,29 @@ import org.w3c.dom.Node; public class FunNamespaceURIForPrefix extends BasicFunction { + + protected static final String FUNCTION_DESCRIPTION = + "Returns the namespace URI of one of the in-scope namespaces " + + "for $element, identified by its namespace prefix.\n\n" + + "If $element has an in-scope namespace whose namespace prefix " + + "is equal to $prefix, it returns the namespace URI of that namespace. " + + "If $prefix is the zero-length string or the empty sequence, it " + + "returns the namespace URI of the default (unnamed) namespace. " + + "Otherwise, it returns the empty sequence.\n\n" + + + "Prefixes are equal only if their Unicode code points match exactly."; + + public final static FunctionSignature signature = new FunctionSignature( new QName("namespace-uri-for-prefix", Function.BUILTIN_FUNCTION_NS), - "Returns the namespace URI of one of the in-scope namespaces for $b, identified by its namespace prefix. " + - "If $b has an in-scope namespace whose namespace prefix is equal to $a, it returns the namespace " + - "URI of that namespace. If $b is the zero-length string or the empty sequence, " + - "it returns the namespace URI of the default (unnamed) namespace. Otherwise, " + - "it returns the empty sequence.", + FUNCTION_DESCRIPTION, new SequenceType[] { - new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE), - new SequenceType(Type.ELEMENT, Cardinality.EXACTLY_ONE) + new FunctionParameterSequenceType("prefix", Type.STRING, Cardinality.ZERO_OR_ONE, ""), + new FunctionParameterSequenceType("element", Type.ELEMENT, Cardinality.EXACTLY_ONE, "") }, - new SequenceType(Type.ANY_URI, Cardinality.ZERO_OR_ONE)); + new FunctionReturnSequenceType(Type.ANY_URI, Cardinality.ZERO_OR_ONE, "the namespace URI")); public FunNamespaceURIForPrefix(XQueryContext context) { super(context, signature); Modified: trunk/eXist/src/org/exist/xquery/functions/FunNilled.java =================================================================== --- trunk/eXist/src/org/exist/xquery/functions/FunNilled.java 2009-07-31 01:17:01 UTC (rev 9593) +++ trunk/eXist/src/org/exist/xquery/functions/FunNilled.java 2009-07-31 02:42:17 UTC (rev 9594) @@ -32,6 +32,8 @@ import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.BooleanValue; +import org.exist.xquery.value.FunctionParameterSequenceType; +import org.exist.xquery.value.FunctionReturnSequenceType; import org.exist.xquery.value.Item; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; @@ -49,9 +51,11 @@ public final static FunctionSignature signature = new FunctionSignature( new QName("nilled", Function.BUILTIN_FUNCTION_NS), - "Returns whether $a is nilled of not.", - new SequenceType[] { new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE) }, - new SequenceType(Type.BOOLEAN, Cardinality.ZERO_OR_ONE)); + "Returns an xs:boolean indicating whether the argument node is \"nilled\". " + + "If the argument is not an element node, returns the empty sequence. " + + "If the argument is the empty sequence, returns the empty sequence.", + new SequenceType[] { new FunctionParameterSequenceType("arg", Type.NODE, Cardinality.ZERO_OR_ONE, "") }, + new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.ZERO_OR_ONE, "true if the argument node is \"nilled\"")); public FunNilled(XQueryContext context) { super(context, signature); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |