[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Schemas: Regular Expression Question

  • From: "Roger L. Costello" <costello@m...>
  • To: xml-dev@l..., xerces-j-dev@x...
  • Date: Sun, 03 Sep 2000 16:39:32 -0400

xerces regular expression
Hi Folks,

Consider this regular expression:

(.)+\.(gif|jpg|jpeg|bmp)

As I interpret this regular expression it says, "one or more occurrences
of any character, followed by a dot, followed by either gif or jpg or
jpeg or bmp".  Correct?

Here's my question - why is it that two schema validators (Oracle and
xerces 1.2) both accept the following strings:

images\mighty_oj.gif
images\omega.jpg
images\wheateena.jpg

but reject these strings:

images\champion.gif
images\greenPower.jpg
images\juiceman.jpg

Both schema validators generate an error, reporting that the strings are
"invalid text".  Am I missing something obvious?  Why are these strings
invalid?  (Are xerces and Oracle using the same regular expression
parser?)  Below is the actual XML Schema and instance document for those
interested.  /Roger

XML Schema

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
        targetNamespace="http://www.test.org"
        elementFormDefault="qualified"
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xsi:schemaLocation=
                    "http://www.w3.org/1999/XMLSchema
                     http://www.w3.org/1999/XMLSchema.xsd"
        xmlns:t="http://www.test.org">
    <element name="images">
        <complexType>
            <sequence>
                <element name="image" type="t:imageType"
                         maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
    <simpleType name="imageType" base="string">
        <pattern value="(.)+\.(gif|jpg|jpeg|bmp)"/>
    </simpleType>
</schema>

Instance Document

<?xml version="1.0"?>
<images xmlns ="http://www.test.org"
         xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
         xsi:schemaLocation="http://www.test.org
                             test.xsd">
     <image>images\mighty_oj.gif</image>
     <image>images\champion.gif</image>
     <image>images\greenPower.jpg</image>
     <image>images\juiceman.jpg</image>
     <image>images\omega.jpg</image>
     <image>images\wheateena.jpg</image>
</images>


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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