Re: [basex-talk] One of the map element causes SEPM0017 error

2020-04-06 Thread Christian Grün
Dear Arkadiusz,

I have improved argument parsing for the fn:serialize function. Your
code snippet from Priscilla’s great reference book will be
successfully evaluated with the latest stable snapshot of BaseX [1].

Dziękuję & cześć,
Christian

[1] http://files.basex.org/releases/latest/



On Fri, Apr 3, 2020 at 6:51 PM Arkadiusz Bok  wrote:
>
> Hi,
> I'm trying to run one of unchanged code example from book "XQuery: Search 
> Across a Variety of XML Data 2nd Edition" from publisher O'Reilly Media.
>
> (: XQuery by Priscilla Walmsley (c) 2016 Priscilla Walmsley:)
>
> (:Example 13-4 Serialization parameters in a map :)
> xquery version "3.1";
> declare namespace prod = "http://datypic.com/prod;;
> let $map := map {
>"method": "xml",
>"version": "1.0",
>"indent": true(),
>"cdata-section-elements": (xs:QName("prod:desc"),xs:QName("prod:name")),
>"use-character-maps": map {
>"«":"%",
>"»":"%"
>  }
> }
> let $element := Fleece Pullover
> return serialize($element,$map)
>
> I'm using BaseX 9.3.2 to do this. But when I'm trying to run code, I get 
> error:
>
> Stopped at C:/Users/Arek/AppData/Local/Temp/example1304.xqy, 16/17:
> [SEPM0017] item() expected, xs:QName+ found: (Q{http://datypic.com/prod}desc, 
> Q{http://datypic.com/prod}name).
>
> When i remove 9 line with cdata-section-elements element, code runs. Whether 
> is it problem with XQuery implementation or with code?


Re: [basex-talk] One of the map element causes SEPM0017 error

2020-04-06 Thread Christian Grün
Hi Arkadius,

In BaseX, the serialization parameters were added to fn:serialize
before the feature was added to the official spec, that’s why the
implementation still differs a little. You’ll need to supply the CDATA
section element names in a single string:

  let $map := map {
"cdata-section-elements": "a xml c"
  }
  let $element := Hello
  return serialize($element,$map)

If the element name has a namespace, the EQName notation will do the job:

  declare namespace prod = "http://datypic.com/prod;;
  let $map := map { "cdata-section-elements":
"Q{http://datypic.com/prod}desc Q{http://datypic.com/prod}name;
  }
  let $element := Fleece Pullover
  return serialize($element,$map)

We’ll align the behavior in a future version of BaseX.

Hope this helps,
Christian



On Fri, Apr 3, 2020 at 6:51 PM Arkadiusz Bok  wrote:
>
> Hi,
> I'm trying to run one of unchanged code example from book "XQuery: Search 
> Across a Variety of XML Data 2nd Edition" from publisher O'Reilly Media.
>
> (: XQuery by Priscilla Walmsley (c) 2016 Priscilla Walmsley:)
>
> (:Example 13-4 Serialization parameters in a map :)
> xquery version "3.1";
> declare namespace prod = "http://datypic.com/prod;;
> let $map := map {
>"method": "xml",
>"version": "1.0",
>"indent": true(),
>"cdata-section-elements": (xs:QName("prod:desc"),xs:QName("prod:name")),
>"use-character-maps": map {
>"«":"%",
>"»":"%"
>  }
> }
> let $element := Fleece Pullover
> return serialize($element,$map)
>
> I'm using BaseX 9.3.2 to do this. But when I'm trying to run code, I get 
> error:
>
> Stopped at C:/Users/Arek/AppData/Local/Temp/example1304.xqy, 16/17:
> [SEPM0017] item() expected, xs:QName+ found: (Q{http://datypic.com/prod}desc, 
> Q{http://datypic.com/prod}name).
>
> When i remove 9 line with cdata-section-elements element, code runs. Whether 
> is it problem with XQuery implementation or with code?


[basex-talk] One of the map element causes SEPM0017 error

2020-04-03 Thread Arkadiusz Bok

Hi,
I'm trying to run one of unchanged code example from book "XQuery: 
Search Across a Variety of XML Data 2nd Edition" from publisher O'Reilly 
Media.


|(: XQuery by Priscilla Walmsley (c) 2016 Priscilla Walmsley:) |

|(:Example 13-4 Serialization parameters in a map :) xquery version 
"3.1"; declare namespace prod = "http://datypic.com/prod;; let $map := 
map { "method": "xml", "version": "1.0", "indent": true(), 
"cdata-section-elements": (xs:QName("prod:desc"),xs:QName("prod:name")), 
"use-character-maps": map { "«":"%", "»":"%" } } let $element := 
Fleece Pullover return serialize($element,$map) |


I'm using BaseX 9.3.2 to do this. But when I'm trying to run code, I get 
error:


|Stopped at C:/Users/Arek/AppData/Local/Temp/example1304.xqy, 16/17: 
[SEPM0017] item() expected, xs:QName+ found: 
(Q{http://datypic.com/prod}desc, Q{http://datypic.com/prod}name). |


When i remove 9 line with /cdata-section-elements/ element, code runs. 
Whether is it problem with XQuery implementation or with code?




(: XQuery by Priscilla Walmsley (c) 2016 Priscilla Walmsley:)
(:Example 13-4 Serialization parameters in a map :)
xquery version "3.1";
declare namespace prod = "http://datypic.com/prod;; 
let $map := map {
   "method": "xml",
   "version": "1.0",
   "indent": true(),
   "cdata-section-elements": (xs:QName("prod:desc"),xs:QName("prod:name")),
   "use-character-maps": map {
   "«":"%",
   "»":"%"
 }
}
let $element := Fleece Pullover
return serialize($element,$map)