Print

Print


Dear all,

I have a question regarding the restriction of whitespace in attribute
values.
I restrict the pattern that can appear in the KEY attribute to
*"a A or a G followed by six digits, or otherwise the value 'unknown*'"
like that in the ODD:
<attDef ident="key" mode="change">
                            <desc>Key for the authority database.</desc>
                            <datatype>
                                <rng:data type="token">
                                    <rng:param
name="pattern">(A\d{6})|(G\d{6})|unknown</rng:param>
                                </rng:data>
                            </datatype>
                        </attDef>
(i know the regex could be shorter, but we keep it like that for legibility)

Now the schema produced from this duly records this as:
attribute key {
      xsd:token { pattern = "(A\d{6})|(G\d{6})|unknown" }
    }?, validates

and validates eg.:
<persName key="A003597">XXXX</persName>

It does however also validate KEY values with whitespace before or after the
token such as:
<persName key="    A003597">XXXX</persName>

or

<persName key="A003597  ">XXXX</persName>

I wish the schema could catch that, but do not understand why it doesn't.
Any ideas?

thanks for thinking about this

marcus
-- 
============================
Dr. Marcus Bingenheimer 馬德偉
Dharma Drum Buddhist College  法鼓佛教研修學院 (DDBC)
No. 2-6 Xishihu, Jinshan  20842, Taipei County, Taiwan, R.O.C.
台灣,20842台北縣金山鄉西勢湖2-6號  Tel:  +886-2-2498-0707#2227
http://buddhistinformatics.ddbc.edu.tw/~mb/