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

Bad Design? An XML Schema that forces applications to maintain state

  • From: Roger L Costello <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Mon, 6 Feb 2023 18:47:09 +0000

Bad Design? An XML Schema that forces applications to maintain state
Hi Folks,

I am working with an XML Schema that specifies the structure of XML-formatted messages. The messages contain data about a military battle. A battle may be just started, in progress, or finished.

The XML Schema has an element declaration that specifies the battlefield status:

<xs:element name="BattlefieldStatusCode" minOccurs="0">
    <xs:simpleType>
        <xs:restriction base="xs:string">
            <xs:enumeration value="AT START"/>
            <xs:enumeration value="IN PROGRESS"/>
            <xs:enumeration value="FINISHED"/>
        </xs:restriction>
    </xs:simpleType>
</xs:element>

The <BattlefieldStatusCode> element is optional (minOccurs="0").

The documentation says that when the first message is sent, the XML document must contain the <BattlefieldStatusCode> element; e.g., the first message contains this:

<BattlefieldStatusCode>IN PROGRESS</BattlefieldStatusCode>

The documentation goes on to say that subsequent messages may omit the element if its value is unchanged.

Eek!

Think about the implications of that for an application processing the XML messages. When the application receives the first message, the application must remember the value of <BattlefieldStatusCode>. When the next message arrives, if the message has no <BattlefieldStatusCode> element, then the application knows the battlefield status because that status value was previously stored.

In other words, the XML Schema forces applications to maintain state. 

Isn't that really, really bad?

Imagine trying to map this battlefield message data format to some other battlefield data format. You would have to do state-dependent mapping. Ugh! That's awful! Right?

/Roger




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.