Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Re: problems at pattern facet creation/validation
Re: problems at pattern facet creation/validation [message #191757] Wed, 25 April 2007 06:27 Go to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Thomas,

Comments below.

Thomas Paradies wrote:
> Hi,
>
> I've used the wtp xsd schema editor for a long time and was always
> happy with it but today I've noticed strange behaviour while editing
> and validating a pattern facet:
Note that the WTP schema editor is provided by the WTP project not
directly by the XSD project which just provides a crude sample editor.
So I've added the webtools newsgroup to the "to" list so they will see
your question and answer it.
>
> ----
>
> First of all I found relevant differences in validation of regular
> expressions between Regular Expression Wizard and XSD Schema Editor.
>
> So what's going wrong?
> Suppose I want to define an range of letters using their hex values
> e.g. [\x40-\x42]+. Using the Regular Expression Wizard from the
> properties view this expression is fine and testable. After finishing
> I'm going to validate the schema (context menu in the source editor ->
> validate). Then the validator reports the following error:
Unfortunately I don't know anything about the regular expression
wizard. Hopefully it's not just a wizard for editing Java regular
expressions which have a different syntax than XML Schema's regular
expressions.
>
> "InvalidRegex: Pattern value '[\x40-\x42]+' is not a valid regular
> expression. The reported error was: 'This expression is not supported
> in the current option setting.'."
I can't see anything in the specification that allows for \x escaping.
>
> I know this is reported by Xerces but I've found no way neither to
> show nor to control the regex options. Is this a bug or am I doing
> something wrong?
Well, it doesn't look right to me. I think Xerces regular expression
code is general enough to support different options, but for XML Schema
purposes it has to use the XML Schema option and I don't think your
expression is right according to that.
>
> ----
>
> The second issue I'd noticed appears when I've edited the expression
> with the wizard again. The value of the pattern node has changed but
> also a value attribute to the type node is added as shown below.
>
> - schema source fragment before editing:
>
> <xsd:simpleType name="XSDSimpleType">
> <xsd:restriction base="xsd:string">
> <xsd:pattern
> value="[0x40-0x42]+"></xsd:pattern>
> </xsd:restriction>
> </xsd:simpleType>
>
> - schema source fragment after editing:
>
> <xsd:simpleType name="XSDSimpleType" value="[\x40-\x43]+">
> <xsd:restriction base="xsd:string">
> <xsd:pattern
> value="[0x40-0x43]+"></xsd:pattern>
> </xsd:restriction>
> </xsd:simpleType>
>
>
> Seems to be a buggy ...
It's certainly not correct. But I can't reproduce it with the sample
editor so I don't think it's a problem in the XSD model itself.
>
> ----
>
> Thomas
Re: problems at pattern facet creation/validation [message #191764 is a reply to message #191757] Wed, 25 April 2007 08:23 Go to previous message
Eclipse User
Originally posted by: paradies.transit-online.de

Ed,
thank you for your prompt response. See below ...
> Thomas,
>
> Comments below.
>
> Thomas Paradies wrote:
>> Hi,
>>
>> I've used the wtp xsd schema editor for a long time and was always
>> happy with it but today I've noticed strange behaviour while editing
>> and validating a pattern facet:
> Note that the WTP schema editor is provided by the WTP project not
> directly by the XSD project which just provides a crude sample editor.
> So I've added the webtools newsgroup to the "to" list so they will see
> your question and answer it.
Sorry, that was not obvious to me. Thanks for the hint.
>>
>> ----
>>
>> First of all I found relevant differences in validation of regular
>> expressions between Regular Expression Wizard and XSD Schema Editor.
>>
>> So what's going wrong?
>> Suppose I want to define an range of letters using their hex values
>> e.g. [\x40-\x42]+. Using the Regular Expression Wizard from the
>> properties view this expression is fine and testable. After finishing
>> I'm going to validate the schema (context menu in the source editor ->
>> validate). Then the validator reports the following error:
> Unfortunately I don't know anything about the regular expression
> wizard. Hopefully it's not just a wizard for editing Java regular
> expressions which have a different syntax than XML Schema's regular
> expressions.
I'm afraid yes, but we'll see ...
>>
>> "InvalidRegex: Pattern value '[\x40-\x42]+' is not a valid regular
>> expression. The reported error was: 'This expression is not supported
>> in the current option setting.'."
> I can't see anything in the specification that allows for \x escaping.
You're right it's Perl-like but I found it also for Xerces (see
http://xerces.apache.org/xerces-j/apiDocs/org/apache/xerces/ utils/regex/RegularExpression.html)
..
>>
>> I know this is reported by Xerces but I've found no way neither to
>> show nor to control the regex options. Is this a bug or am I doing
>> something wrong?
> Well, it doesn't look right to me. I think Xerces regular expression
> code is general enough to support different options, but for XML Schema
> purposes it has to use the XML Schema option and I don't think your
> expression is right according to that.
Well, then should the expression [#x40-#x43]+ do it, right? The
validation reports

"InvalidRegex: Pattern value '[#x40-#x43]+' is not a valid regular
expression. The reported error was: 'The range end code point is less
than the start code point.'"

Strange! But the expression without range [#x40#x43]+ is correct. Also
with the sample editor...
>>
>> ----
>>
>> The second issue I'd noticed appears when I've edited the expression
>> with the wizard again. The value of the pattern node has changed but
>> also a value attribute to the type node is added as shown below.
>>
>> - schema source fragment before editing:
>>
>> <xsd:simpleType name="XSDSimpleType">
>> <xsd:restriction base="xsd:string">
>> <xsd:pattern
>> value="[0x40-0x42]+"></xsd:pattern>
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>> - schema source fragment after editing:
>>
>> <xsd:simpleType name="XSDSimpleType" value="[\x40-\x43]+">
>> <xsd:restriction base="xsd:string">
>> <xsd:pattern
>> value="[0x40-0x43]+"></xsd:pattern>
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>>
>> Seems to be a buggy ...
> It's certainly not correct. But I can't reproduce it with the sample
> editor so I don't think it's a problem in the XSD model itself.
I agree.
>>
>> ----
>>
>> Thomas
Previous Topic:error IWAB0398E when creating wsdl from java source
Next Topic:Changing the location of WebContent
Goto Forum:
  


Current Time: Wed Jul 30 11:35:13 EDT 2014

Powered by FUDForum. Page generated in 0.02417 seconds