Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XQuery

XQuery

Scheduled Pinned Locked Moved XML / XSL
questiontoolshelpannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lutoslaw
    wrote on last edited by
    #1

    I get an error

    XQuery Execution Error! Unexpected token - "($email, '[A-Z0-9._%+-]+@"

    in the following script

    xquery version "1.0";
    declare function local:valid-email($email as xs:string)
    as xs:boolean
    {
    return matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
    };

    Why does it occur? Thanks --

    Greetings - Jacek

    S L 2 Replies Last reply
    0
    • L Lutoslaw

      I get an error

      XQuery Execution Error! Unexpected token - "($email, '[A-Z0-9._%+-]+@"

      in the following script

      xquery version "1.0";
      declare function local:valid-email($email as xs:string)
      as xs:boolean
      {
      return matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
      };

      Why does it occur? Thanks --

      Greetings - Jacek

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Doesn't the 'matches' function need a namespace prefix?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p MVP for 2010 - who'd'a thunk it!

      L 1 Reply Last reply
      0
      • L Lutoslaw

        I get an error

        XQuery Execution Error! Unexpected token - "($email, '[A-Z0-9._%+-]+@"

        in the following script

        xquery version "1.0";
        declare function local:valid-email($email as xs:string)
        as xs:boolean
        {
        return matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
        };

        Why does it occur? Thanks --

        Greetings - Jacek

        L Offline
        L Offline
        Lutoslaw
        wrote on last edited by
        #3

        I have been programming in C too long. There is no "return" instruction in XQuery which means "return". It is a part of from(...) statement exclusively. Solution:

        xquery version "1.0";
        declare function local:valid-email($email as xs:string)
        as xs:boolean
        {
        matches($email, '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}')
        };

        Sorry for not posting the solution earlier.

        Greetings - Jacek

        1 Reply Last reply
        0
        • S Stuart Dootson

          Doesn't the 'matches' function need a namespace prefix?

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p MVP for 2010 - who'd'a thunk it!

          L Offline
          L Offline
          Lutoslaw
          wrote on last edited by
          #4

          See my post below. That was a pure syntax error.

          Greetings - Jacek

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups