|
|
xdmp:email(
|
|
$message as node()
|
| ) as empty-sequence() |
|
 |
Summary:
Send an email in an XQuery program. A valid SMTP Relay must be
configured in the Groups page of the Admin Interface for the email to be
sent. The format of the email message must be an XML file that
complies with the schema files listed below.
|
Parameters:
$message
:
An XML representation of an email message to send. The message must
comply with the XML schemas defined in the following schema files:
install_dir/Config/email-xml.xsd
install_dir/Config/rfc822.xsd
where install_dir is the directory in which
MarkLogic Server is installed.
|
|
Required Privilege:
http://marklogic.com/xdmp/privileges/xdmp-email
|
Example:
This example demonstrates sending a message with
HTML content.
xdmp:email(
<em:Message
xmlns:em="URN:ietf:params:email-xml:"
xmlns:rf="URN:ietf:params:rfc822:">
<rf:subject>Sample HTML Email</rf:subject>
<rf:from>
<em:Address>
<em:name>MarkLogic</em:name>
<em:adrs>marklogic@yourdomain</em:adrs>
</em:Address>
</rf:from>
<rf:to>
<em:Address>
<em:name>System Administrator</em:name>
<em:adrs>admin@yourdomain</em:adrs>
</em:Address>
</rf:to>
<em:content>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test HTML message</title>
</head>
<body>
<h1>Test HTML message</h1>
<p>Here is a simple paragraph</p>
</body>
</html>
</em:content>
</em:Message>)
|
Example:
This example demonstrate sending a message with
plain text content.
xdmp:email(
<em:Message
xmlns:em="URN:ietf:params:email-xml:"
xmlns:rf="URN:ietf:params:rfc822:">
<rf:subject>Sample Plain Text Email</rf:subject>
<rf:from>
<em:Address>
<em:name>MarkLogic</em:name>
<em:adrs>marklogic@yourdomain</em:adrs>
</em:Address>
</rf:from>
<rf:to>
<em:Address>
<em:name>System Administrator</em:name>
<em:adrs>admin@yourdomain</em:adrs>
</em:Address>
</rf:to>
<em:content xml:space="preserve">
This is a sample email with a plain text body.
</em:content>
</em:Message>)
|
Example:
This example demonstrates sending a message with
attachments.
let $newline := " "
let $boundary := concat("blah", xdmp:random())
let $content-type := concat("multipart/mixed; boundary=",$boundary)
let $attachment1 := xs:base64Binary(doc("/space/binaries/testdata1/Bon-Jovi.jpeg"))
let $attachment2 := xs:base64Binary(doc("/space/binaries/testdata1/logo.gif"))
let $content := concat(
"--",$boundary,$newline,
$newline,
"This is a test email with two images attached.", $newline,
"--",$boundary,$newline,
"Content-Type: image/jpeg", $newline,
"Content-Disposition: attachment; filename=Bon-Jovi.jpeg", $newline,
"Content-Transfer-Encoding: base64", $newline,
$newline,
$attachment1, $newline,
"--",$boundary,$newline,
"Content-Type: image/gif", $newline,
"Content-Disposition: attachment; filename=logo.gif", $newline,
"Content-Transfer-Encoding: base64", $newline,
$newline,
$attachment2, $newline,
"--",$boundary,"--", $newline)
return
xdmp:email(
<em:Message
xmlns:em="URN:ietf:params:email-xml:"
xmlns:rf="URN:ietf:params:rfc822:">
<rf:subject>Sample Email</rf:subject>
<rf:from>
<em:Address>
<em:name>MarkLogic</em:name>
<em:adrs>marklogic@yourdomain</em:adrs>
</em:Address>
</rf:from>
<rf:to>
<em:name>System Administrator</em:name>
<em:adrs>admin@yourdomain</em:adrs>
</rf:to>
<rf:content-type>{$content-type}</rf:content-type>
<em:content xml:space="preserve">
{$content}
</em:content>
</em:Message>)
|
|
|
|
xdmp:parse-dateTime(
|
|
$picture as xs:string,
|
|
$value as xs:string,
|
|
[$language as xs:string],
|
|
[$calendar as xs:string],
|
|
[$country as xs:string]
|
| ) as xs:dateTime |
|
 |
Summary:
Parses a string containing date, time or dateTime using the supplied
picture argument and returns a dateTime value. While this function
is closely related to other XSLT functions, it is available in XSLT
as well as in all XQuery dialects.
|
Parameters:
$picture
:
The desired string representation of the given $value.
The picture string is a sequence of characters, in which the
characters represent variables such as, decimal-separator-sign,
grouping-sign, zero-digit-sign, digit-sign, pattern-separator,
percent sign and per-mille-sign. For details on the picture string, see
http://www.w3.org/TR/xslt20/#date-picture-string.
This follows the specification of
picture string in the W3C XSLT 2.0
specification for the fn:format-dateTime function.
Symbol Description
-----------------------------------
'Y' year(absolute value)
'M' month in year
'D' day in month
'd' day in year
'F' day of week
'W' week in year
'w' week in month
'H' hour in day
'h' hour in half-day
'P' am/pm marker
'm' minute in hour
's' second in minute
'f' fractional seconds
'Z' timezone as a time offset from UTC
for example PST
'z' timezone as an offset using GMT,
for example GMT+1
|
$value
:
The given string $value representing the dateTime value
that needs to be formatted.
|
$language
(optional):
The language used in string representation of the date, time or
dateTime value.
|
$calendar
(optional):
This argument is reserved for future use. The only calendar supported
at this point is "Gregorian" or "AD".
|
$country
(optional):
$country is used to take into account if there any country specific
interpretation of the string while converting it into dateTime value.
|
|
Usage Notes:
Dates before October 15, 1582 (the start of the Gregorian calendar) will
not return the correct dateTime value.
|
Example:
xdmp:parse-dateTime("[Y0001]-[M01]-[D01]T[h01]:[m01]:[s01].[f1][Z]","2010-01-06T17:13:50.873594-08:00")
|
|
|
|
xdmp:parse-yymmdd(
|
|
$picture as xs:string,
|
|
$value as xs:string,
|
|
[$language as xs:string],
|
|
[$calendar as xs:string],
|
|
[$country as xs:string]
|
| ) as xs:dateTime |
|
 |
Summary:
Parses a string containing date, time or dateTime using the supplied
picture argument and returns a dateTime value. While this function
is closely related to other XSLT functions, it is available in XSLT
as well as in all XQuery dialects.
|
Parameters:
$picture
:
The desired string representation of the given $value.
This follows the specification of picture string which is
compatible to the format specification in icu. See "http://icu-project.org/apiref/classSimpleDateFormat.html" for more details.
Here is the summary of the formatting symbols:
Symbol Description
----------------------------
"y" year(absolute value)
"M" month in year
"d" day in month
"D" day in year
"E" day of week
"w" week in year
"W" week in month
"H" hour in day
"K" hour in half-day
"a" am/pm marker
"s" second in minute
"S" fractional seconds
"Z" timezone as a time offset from UTC
for example PST
"ZZZZ" timezone as an offset using GMT,
for example GMT+1
|
$value
:
The given string $value that needs to be formatted.
|
$language
(optional):
The language used in string representation of the date, time or
dateTime value.
|
$calendar
(optional):
This argument is reserved for future use. The only calendar supported
at this point is "Gregorian" or "AD".
|
$country
(optional):
$country is used to take into account if there any country specific
interpretation of the string while converting it into dateTime value.
|
|
Usage Notes:
Dates before October 15, 1582 (the start of the Gregorian calendar) will
not return the correct dateTime value.
|
Example:
xdmp:parse-yymmdd("yyyy-MM-ddThh:mm:ss.Sz","2010-01-06T17:13:50.873594-8.00")
|
|
|
|
xdmp:QName-from-key(
|
|
$key as xs:string
|
| ) as xs:QName |
|
 |
Summary:
Construct a QName from a string of the form "{namespaceURI}localname".
This function is useful for constructing Clark notation
parameters for the xdmp:xslt-eval
and xdmp:xslt-invoke
functions.
|
Parameters:
$key
:
The string from which to construct a QName.
|
|
Example:
xquery version "1.0-ml";
(: returns the Clark notation form of the QName :)
xdmp:key-from-QName(xs:QName("fn:foo"))
=>
{http://www.w3.org/2005/xpath-functions}foo
|
|
|