[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] =?utf-8?Q?Re:_Should_XML_appl?==?utf-8?Q?ications_follow_Postel
improving data = "" data strict on output: yes strict on output by refusing input data and reporting: yes strict on output by allowing a developer to change the data a business user or information owner entered: often not Van: "Roger L. Costello" <costello@mitre.org> Aan: "xml-dev" <xml-dev@l...> Verzonden: Donderdag 12 april 2018 15:41:43 Onderwerp: Should XML applications follow Postel’s Law? Postel’s Law says this: Be generous on input, strict on output. This means that the code should be tolerant of variations in its input but should be strictly correct when outputting data. As an example, when you accept a boolean as a string, ignore the case and allow it to be expressed as “1, 0, T, F, Y, N, TRUE, FALSE, YES, NO, etc.”. But when outputting a boolean as a string, stick to one single convention and one single case religiously. [1] So ………… Suppose an application validates XML inputs against an XML Schema. One part of the schema says that the <isFlyOver> element must contain a Boolean value. Here’s how that element is declared: <xs:element
name="isFlyOver">
That element declaration says XML documents must contain either this: <isFlyOver>true</isFlyOver> or this: <isFlyOver>false</isFlyOver> Suppose an application receives an XML document containing this: <isFlyOver>TRUE</isFlyOver> or this: <isFlyOver>1</isFlyOver> Should the application follow Postel’s Law and accept those XML inputs? And then rebuild the XML so that the output strictly adheres to the schema: <isFlyOver>true</isFlyOver> That is, the application validates inputs against this slightly looser schema: <xs:element
name="isFlyOver">
If the input validates against that schema, then the application rebuilds the XML to conform to the strict schema. Thus, if the input arrives as this: <isFlyOver>TRUE</isFlyOver> then the application accepts it and outputs: <isFlyOver>true</isFlyOver> What do you think? Good idea for applications to follow Postel’s Law? Bad idea? Good in some applications and bad in others? Thoughts? /Roger [1] http://tedwise.com/2009/05/27/generous-on-input-strict-on-output
[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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|