473,394 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XMLSPY bug? Patterns at different derivation steps getting OR'ed instead of AND'ed.

I received a file from a business partner. I ran it through XercesJ and it
choked on the following element:

<wcb-case-number>0</wcb-case-number>

To debug this issue, I loaded it into XMLSPY and hit validate...it passed.
Here are the related type/element definitions:

// Redefine built-in string type to limit range of characters, mostly
// to eliminate undesirable white space (tab, cr, lf, etc.)
<xs:simpleType name="WcbString">
<xs:restriction base="string">
<xs:pattern value="[&#x20;-&#x7e;]*"/>
</xs:restriction>
</xs:simpleType>

// Define a text type which essentially says "if present, must have
// at least one character"
<xs:simpleType name="WcbText">
<xs:restriction base="WcbString">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

// Project-specific type: case id
<xs:simpleType name="CaseID">
<xs:restriction base="WcbText">
// Yes, I know '[\dADF]\d{7}' is more concise, but I prefer this
<xs:pattern value="[0-9ADF][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"/>
</xs:restriction>
</xs:simpleType>

// Define the element
<xs:element name="wcb-case-number" type="CaseID" minOccurs="0"/>

I know our partner used XMLSPY to validate it because it had the 'edited by
XMLSPY' comment at the top. Before I respond to this, I need some
confirmation of a bug in XMLSPY.

Section 4.3.4.3 of the XML Schema specification
(http://www.w3.org/TR/2004/REC-xmlsch...types.html#dt-
pattern) is pretty clear to me on how patterns should be treated in a case
like this (ANDed, not ORed), but XMLSPY isn't working that way. In fact,
when you click on the wcb-case-number element in the XML file, it actually
shows the pattern it's using as:
"[&#x20;-&#x7e;]*|[0-9ADF][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"

Anyone disagree and think XMLSPY is working correctly? Basically, I can
work-around the issue by making the base type of CaseID the built-in
'string' type. I will be doing this because I want our partners who use
XMLSPY to be able to properly validate their files. However, I want to be
certain when I say 'this new schema change is necessary to account for bugs
in XMLSPY' that I'm actually correct.

TIA!

-Patrick

--
Patrick Maloney
New York State Workers' Compensation Board

(Remove REMOVE from e-mail address to reply)
Jul 20 '05 #1
2 2056
Hi Patrick,

You are right; it must be a bug in XMLSpy. If the patterns were at the
same derivation level, they would be OR-ed. But, since they are
different levels, they should be AND-ed. Making the base type xs:string
should solve your problem.

Hope that helps,
Priscilla
-----------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema (Prentice Hall PTR)
http://www.datypic.com
-----------------------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #2
Priscilla Walmsley <no****@datypic.com> wrote in news:418cceb8$0$14466
$c******@news.newsgroups.ws:
Hope that helps,
Priscilla


Yes, it does...thanks Priscilla!

--
Patrick Maloney
New York State Workers' Compensation Board

(Remove REMOVE from e-mail address to reply)
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Albretch | last post by:
.. Can you define the Character Set for particular tables instead of databases? . Which DBMSs would let you do that? . How do you store in a DBMS i18n'ed users' from input, coming over the web...
3
by: Cat | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm having trouble getting my head around the reason the that following file won't validate with the following error output in Xerces version...
4
by: Lars Geldner | last post by:
Hello, I'm searching for a possibility to define a complex type using xml schema that can only be derived by restriction. The sub-complex type should have a content model that only contains...
3
by: hre1 | last post by:
stan, once more, thank you for your assistance and patience. can you explain in more detail why my code violates the particle restriction ok (Elt:Elt -- NameAndTypeOK)? i tried to understand...
10
by: Emilio | last post by:
Do I use 'or' for bitwise operations where in c# I use | ?
8
by: kk_oop | last post by:
Hi. In our domain, we have to vary a lot of code based on a radar type (of which there are 3--for now). The legacy code acheives this by heavy use of #ifdef macros sprinkled throughout the code. ...
24
by: John Salerno | last post by:
Since Python does so many things different, especially compared to compiled and statically typed languages, do most of the basic design patterns still apply when writing Python code? If I were to...
18
by: MajorSetback | last post by:
I am using the Redhat version of Linux and GNU C++. It is not clear to me whether this is a Linux issue or a C++ issue. I do not have this problem running the same program on Windows but...
14
by: Mat| | last post by:
Hello :-) I am learning XPath, and I am trying to get child nodes of a node whose names do *not* match a given string, e.g : <dummy> <example> <title>Example 1</title> <body>this is an...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.