New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulty error reported using ml-1.0 syntax #112

Closed
hutchkintoot opened this Issue Aug 15, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@hutchkintoot

hutchkintoot commented Aug 15, 2014

The following line using ml-1.0 syntax produces syntax errors in version 2.1.0. The code works when deployed on the server.

It is probably the creation of the binary-node that the syntax-checker is unaware of.

return xdmp:hmac-sha1(binary { xs:hexBinary(xs:base64Binary($secret)) } , $message,"base64")

Regards,
Johan Mörén

@cfoster

This comment has been minimized.

Show comment
Hide comment
@cfoster

cfoster Aug 15, 2014

Johan, there are two things you could do to get around this at the moment,

  1. Make a module somewhere with a function like:
declare function ns:binary($object) as binary() {
  binary { $object }
};

Then import the library and use this function to cast to binary() nodes in your XQuery code.

  1. Use code, along the lines of this in your Main Module:
declare function local:binary($object) {
  xdmp:eval(
   "declare variable $e external; binary { $e }",
   (fn:QName("","e"), $object),
   <options xmlns="xdmp:eval">
     <isolation>same-statement</isolation>
   </options>
  )
};

local:binary(
  xs:hexBinary(xs:base64Binary("aS4="))
)

cfoster commented Aug 15, 2014

Johan, there are two things you could do to get around this at the moment,

  1. Make a module somewhere with a function like:
declare function ns:binary($object) as binary() {
  binary { $object }
};

Then import the library and use this function to cast to binary() nodes in your XQuery code.

  1. Use code, along the lines of this in your Main Module:
declare function local:binary($object) {
  xdmp:eval(
   "declare variable $e external; binary { $e }",
   (fn:QName("","e"), $object),
   <options xmlns="xdmp:eval">
     <isolation>same-statement</isolation>
   </options>
  )
};

local:binary(
  xs:hexBinary(xs:base64Binary("aS4="))
)
@hutchkintoot

This comment has been minimized.

Show comment
Hide comment
@hutchkintoot

hutchkintoot Aug 15, 2014

Thanks for the quick response and the work around! It is not really a problem. Just wanted to make you know about the issue. I can live with the red-marking for now. But since it is valid ml-1.0 syntax i guess it should be fixed. But I'm in no hurry :)

/Johan

hutchkintoot commented Aug 15, 2014

Thanks for the quick response and the work around! It is not really a problem. Just wanted to make you know about the issue. I can live with the red-marking for now. But since it is valid ml-1.0 syntax i guess it should be fixed. But I'm in no hurry :)

/Johan

@ligasgr

This comment has been minimized.

Show comment
Hide comment
@ligasgr

ligasgr Aug 15, 2014

Owner

Hi
Thanks for raising the issue.
The fact that it is not parsed as a valid syntax is because the plugin was written with version 3.0 in mind and not as a multi-dialect.
Binary nodes are marklogic specific and they never came into 3.0.
I'll have a look and see if it'll make sense to have separate parsing rules based on the dialect picked or simply an error highlighting if binary node is used when not in marklogic mode.

Owner

ligasgr commented Aug 15, 2014

Hi
Thanks for raising the issue.
The fact that it is not parsed as a valid syntax is because the plugin was written with version 3.0 in mind and not as a multi-dialect.
Binary nodes are marklogic specific and they never came into 3.0.
I'll have a look and see if it'll make sense to have separate parsing rules based on the dialect picked or simply an error highlighting if binary node is used when not in marklogic mode.

@ligasgr ligasgr added the feature label Aug 15, 2014

@ligasgr ligasgr closed this in a6ebe47 Sep 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment