XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Bad Design? An XML Schema that forces applications tomaintain state

I don't think it's intrinsically bad either (a) to have a dialogue consisting of a sequence of messages in which the interpretation of an individual message requires knowledge of the state of the dialogue, or (b) to use XML to encode those messages.

But of course, those messages will be meaningless out of context.

Michael Kay
Saxonica

> On 6 Feb 2023, at 18:47, Roger L Costello <costello@mitre.org> wrote:
> 
> 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
> 
> 
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 



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


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS