Thanks to everyone! I was able to get what I needed and learn a little more in the process. I appreciate all the options.
Thanks again,
Bill
Bill Hayden
Sent from blackberry
From: Jakob Fix [mailto:***@gmail.com]
Sent: Wednesday, January 29, 2014 04:14 PM
To: MarkLogic Developer Discussion <***@developer.marklogic.com>
Subject: Re: [MarkLogic Dev General] error message (err:XPTY0004) arg1 is not of type xs:string?
<results warning="more than one root item">Nothing dog cat foo bar cat</results>
as it says, it's not an actual error, but an indication that you're apparently using the query console's XML output option to return non-XML. As it's returning more than one item and none of them an XML element, the query console wraps it in a root element to make it well-formed.
It seems that the query console has gotten cleverer with ML7 because it's now offering only Auto and Raw as output options and I couldn't bring it to generate the equivalent output.
so, just to say this is nothing to worry about.
cheers,
Jakob.
On Wed, Jan 29, 2014 at 8:17 PM, Hayden, William T <***@boeing.com<mailto:***@boeing.com>> wrote:
Thanks Mary. Like I said I have tried many options. The equality match options yields the following errored results without an actual error: <results warning="more than one root item">Nothing dog cat foo bar cat</results>
I havenât tried running a loop until now and this is what I'm getting"
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
declare variable $file-types := ("dog","cat","foo","bar");
let $file-type := ("cat")
(:
return if (fn:matches($file-types, $file-type)) then
else
(
)
:)
let $nothing :=
fn:empty(
for $f in $file-types return
if (fn:matches($f, $file-type)) then "ok" else ())
+++++++++++++++++++++++++++
Results
+++++++++++++++++++++++++++
[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected $end
Stack Trace
At line 18 column 57:
16. fn:empty(
17. for $f in $file-types return
18. if (fn:matches($f, $file-type)) then "ok" else ())
19.
I know it is something simple, this is one of those cases where for some reason, I just don't see it!
Thanks
bill
-----Original Message-----
From: Mary Holstege [mailto:***@marklogic.com<mailto:***@marklogic.com>]
Sent: Wednesday, January 29, 2014 12:56 PM
To: ***@developer.marklogic.com<mailto:***@developer.marklogic.com>; Hayden, William T
Subject: Re: [MarkLogic Dev General] error message (err:XPTY0004) arg1 is not of type xs:string?
Post by Hayden, William TPerhaps one of you can see the error of my ways. I have tried so many
options with no success. I am using ML5. Here is the latest
simplified version followed by the failing results.
Thanks in advance!
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml"; declare
variable $file-types := ("dog","cat","foo","bar");
let $file-type := ("cat")
return if (fn:matches($file-types, $file-type)) then
("Nothing", $file-types, $file-type)
else
(
)
+++++++++++++++++++++++++++
Results
+++++++++++++++++++++++++++
[1.0-ml] XDMP-ARGTYPE: (err:XPTY0004) fn:matches(("dog", "cat", "foo",
...), "cat") -- arg1 is not of type xs:string?
Stack Trace
$file-type := "cat"
6.
7.
8. return if (fn:matches($file-types, $file-type)) then 9. ("Nothing",
$file-types, $file-type) 10. else
fn:matches wants there to be a single value a the
first argument: it is a regular expression match of
one value against one regular expression.
If you are just doing an equality match you can
use the "=" operator (which will operate over
sequences and return true if any member is
equal:
$file-type = $file-types
If you really mean fn:match, then you need
to run the loop yourself:
let $nothing :=
fn:empty(
for $f in $file-types return
if (fn:matches($f, $file-type)) then "ok" else ())
If there is any match the sequence given to fn:empty
will be non-empty so $nothing is false.
//Mary
_______________________________________________
General mailing list
***@developer.marklogic.com<mailto:***@developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general