XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Jack TanSubject: Java exception when apply regular expression
Author: Jack Tan
Date: 28 Feb 2007 07:36 PM
I tested a small XQUERY program in the Stylus Studio 2006 Enterprise, build 653g.
In the scenarion using internal XQUERY processor all went smoothly. When switched to Saxon 8.7.1 it reports error:

error 719, FORX0002: Errot at character 1 in regular expressio "\x11|\\n" invalid escape sequence.

the offended line is:

...
fn:replace($var/name,"\x22|\\n"," ")
...

I simply want to replace "" and new lines in a string.

Why Saxon differs from the internal processor? What is wrong?

any pointers to relevant documentation suummarizing a correct course of action?

Thx

Jack

Postnext
(Deleted User) Subject: Java exception when apply regular expression
Author: (Deleted User)
Date: 05 Mar 2007 11:42 AM
Originally Posted: 05 Mar 2007 11:43 AM
Hi Jack,
the correct regex would be """|\n"

Hope this helps,
Alberto

Postnext
Jack TanSubject: Java exception when apply regular expression
Author: Jack Tan
Date: 05 Mar 2007 02:41 PM
Thx,

Where can I find a document describing a difference between internal processor and Saxon? and when/why one should be used ?

Jack

Postnext
(Deleted User) Subject: Re: Java exception when apply regular expression
Author: (Deleted User)
Date: 06 Mar 2007 03:07 AM
Hi Jack,
the syntax of the regular expressions used in XQuery and XSLT is
described in the specs
(http://www.w3.org/TR/xpath-functions/#regex-syntax) that in turn is
based on the syntax described by the XMLSchema specs
(http://www.w3.org/TR/xmlschema-2/#regexs). There it's explained that
the only characters that need to be escaped are new lines, tab, and
the special characters \|.-^?*+{}()[].
This means that the regex you are specifying is: "|\n
As you need to insert this string inside an XQuery string literal,
you can choose to wrap it inside single quotes ('"|\n') or double
quotes, escaping the quote by duplicating it ("""|\n").
This is the official regex syntax, that both processor supports; the
internal processor also allows the usage of the syntax \xAA to
represent characters, but that is an implementation-specific extension.

Hope this helps,
Alberto

Posttop
Jack TanSubject: Re: Java exception when apply regular expression
Author: Jack Tan
Date: 07 Mar 2007 01:37 PM
Alberto,

It seems that the safest way in defining scenario is to avoid the default internal processor ;-)

Thanks for help,

Jack

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.