OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XML Schemas: Regular Expression Question

[ Lists Home | Date Index | Thread Index ]
  • From: "Roger L. Costello" <costello@mitre.org>
  • To: xml-dev@lists.xml.org, xerces-j-dev@xml.apache.org
  • Date: Sun, 03 Sep 2000 16:39:32 -0400

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>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS