Incorrect pattern matching

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Pierre

Incorrect pattern matching

Post by Pierre »

Hi,

One of my pattern matching validation attribute failed without understandeable reason:

The following schema is used :

Code: Select all


....
<xd:simpleType name="t_no.oj">
<xd:restriction base="xd:string">
<xd:pattern value="\d{1,3}(A|E){0,1}"/>
</xd:restriction>
</xd:simpleType>
....
<xd:element ref="NO.OJ" minOccurs="0"/>
....
<xd:element name="NO.OJ" type="t_no.oj"/>
....
The following instance extract is refused :

Code: Select all



<NO.OJ>876</NO.OJ>
My environment seems to be correct :

Windows 2000 workstation

Code: Select all


java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
Best,
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Dear Pierre,

The schema snippet you posted cannot be validated so I changed it as follows:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="t_no.oj">
<xs:restriction base="xs:string">
<xs:pattern value="\d{1,3}(A|E){0,1}"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="NO.OJ" type="t_no.oj"/>
</xs:schema>
If you name this as sample.xsd and in the same directory create an XML file with the following content:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<NO.OJ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="sample.xsd">876</NO.OJ>
the validation check will report no errors.

If you still have problems please post the exact sample files you are using.

Best Regards,
George
Pierre
Posts: 1
Joined: Wed Jun 04, 2003 4:03 pm

Post by Pierre »

Dear George,

Thank you for your endevour. I finally found the problem origin.
The pattern matching is correct but the apparence is well described in the previous post. The reason is simple. UTF-8 Hidden characters exist between <NO.OJ> and 876. With the oxygen editor, I didn't see them. The illegal characters were in hexadecimal EF BB BF.

Is it anyway to view special or hidden characters ?

Best regards,

Pierre
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Pierre,

There is no way currently to view special characters. We will provide support for this in the next version.

Best Regards,
George
Post Reply