[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-dev
Subject:    [xml-dev] A simple and non-brittle way to create XML that evolves over time
From:       "Costello, Roger L." <costello () mitre ! org>
Date:       2015-04-29 13:39:39
Message-ID: DM2PR09MB035180AE18F7E248BD576350C8D70 () DM2PR09MB0351 ! namprd09 ! prod ! outlook ! com
[Download RAW message or body]

Hi Folks,

Acknowledgement: Some of the below text and idea comes from section 4.2 of =
RFC 7493 (http://www.rfc-editor.org/rfc/rfc7493.txt)

It is frequently the case that changes to XML Schemas are required after th=
ey have been put in production.  XML Schemas that allow the introduction of=
 new elements in a way that does not disrupt the operation of existing soft=
ware have proven advantageous in practice.

This can be referred to as a "Must-Ignore" policy, meaning that when an imp=
lementation encounters an element that it does not recognize, it should tre=
at the rest of the document as if the new element simply did not appear, an=
d in particular, the implementation must not treat this as an error conditi=
on.  The converse "Must-Understand" policy does not tolerate the introducti=
on of new elements, and while this has proven necessary in certain designs,=
 in general it has been found to be overly restrictive and brittle.

A good way to support the use of Must-Ignore in XML designs is to require t=
hat the root element must contain a list of key/value pairs where each key =
is unique, and to specify that keys whose names are unrecognized must be ig=
nored.

Example. Here is an XML document where the root element contains a list of =
key/value pairs and each key is unique:

<Book>
    <Title>The First and Last Freedom</Title>
    <Author>J. Krishnamurti</Author>
    <Date>1954</Date>
    <ISBN>0-06-064831-7</ISBN>
    <Publisher>Harper &amp; Row</Publisher>
</Book>

This example shows simple values for each key. Of course the values could b=
e complex.

Suppose that at a later date the XML Schema is extended to include a NumPag=
es element. Now XML instances contain this:

<Book>
    <Title>The First and Last Freedom</Title>
    <Author>J. Krishnamurti</Author>
    <Date>1954</Date>
    <NumPages>289</NumPages>
    <ISBN>0-06-064831-7</ISBN>
    <Publisher>Harper &amp; Row</Publisher>
</Book>

If a consumer of this XML has not been coded to understand that new key/val=
ue pair, the consumer must ignore it.

Recap: design your XML so that the root element contains a list of key/valu=
e pairs where each key is unique. Notify consumers that over time the set o=
f root element keys will expand and they should ignore any root element key=
s they do not understand.

/Roger


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi Folks,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Acknowledgement: Some of the below text and idea comes from \
section 4.2 of RFC 7493 (<a \
href="http://www.rfc-editor.org/rfc/rfc7493.txt">http://www.rfc-editor.org/rfc/rfc7493.txt</a>)
 <o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">It is frequently the case that changes to XML Schemas are \
required after they have been put in production.&nbsp; XML Schemas that allow the \
introduction of new elements in a way that does not disrupt the operation of existing \
software have proven  advantageous in practice.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">This can be referred to as a &quot;Must-Ignore&quot; policy, \
meaning that when an implementation encounters an element that it does not recognize, \
it should treat the rest of the document as if the new element simply did not appear, \
and in particular,  the implementation must not treat this as an error \
condition.&nbsp; The converse &quot;Must-Understand&quot; policy does not tolerate \
the introduction of new elements, and while this has proven necessary in certain \
designs, in general it has been found to be overly restrictive  and \
brittle.<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">A good way to support the use of Must-Ignore in XML designs is \
to require that the root element must contain a list of key/value pairs where each \
key is unique, and to specify that keys whose names are unrecognized must be \
ignored.<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Example. Here is an XML document where the root element contains \
a list of key/value pairs and each key is unique:<o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Book&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Title&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">The First and Last Freedom</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Title&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Author&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;color:black">J. \
Krishnamurti</span><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Author&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Date&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">1954</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Date&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;ISBN&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">0-06-064831-7</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/ISBN&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Publisher&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">Harper </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#969600">&amp;amp;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;color:black"> \
Row</span><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Publisher&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Book&gt;</span><o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal">This example shows \
simple values for each key. Of course the values could be complex.<o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal">Suppose that at a later \
date the XML Schema is extended to include a NumPages element. Now XML instances \
contain this:<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Book&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp; &nbsp;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Title&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">The First and Last Freedom</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Title&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Author&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;color:black">J. \
Krishnamurti</span><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Author&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Date&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">1954</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Date&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><b><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;NumPages&gt;</span></b><b><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">289</span></b><b><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/NumPages&gt;</span></b><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;ISBN&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">0-06-064831-7</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/ISBN&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> &nbsp;&nbsp;&nbsp; </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;Publisher&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black">Harper </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#969600">&amp;amp;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;color:black"> \
Row</span><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Publisher&gt;</span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:black"><br> </span><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif;color:#000096">&lt;/Book&gt;</span><o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal">If a consumer of this \
XML has not been coded to understand that new key/value pair, the consumer must \
ignore it.<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Recap: design your XML so that the root element contains&nbsp;a \
list of key/value pairs where each key is unique. Notify consumers that over time the \
set of root element keys will expand and they should ignore any root element keys \
they do not  understand.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">/Roger<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic