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

List:       xml-dev
Subject:    Re: [xml-dev] A simple and non-brittle way to create XML that evolves over time
From:       Michael Kay <mike () saxonica ! com>
Date:       2015-04-29 14:15:18
Message-ID: 5C8234B6-8BCD-4025-883E-4FFDB6F800C5 () saxonica ! com
[Download RAW message or body]

A variant of this is the XSLT "forwards compatibility" policy where unknown elements \
and attributes are ignored if and only if the version number on the document instance \
is greater than the version number of the application/processor. The benefit of this \
is that you can combine the extensibility goal with the goal of detecting errors \
(e.g. misspelled element names)

Michael Kay
Saxonica
mike@saxonica.com
+44 (0) 118 946 5893




On 29 Apr 2015, at 14:39, Costello, Roger L. <costello@mitre.org> wrote:

> 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 they 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 software have proven \
> advantageous in practice. 
> This can be referred to as a "Must-Ignore" 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.  The \
> converse "Must-Understand" 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. 
> 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. 
> 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 be \
> complex. 
> Suppose that at a later date the XML Schema is extended to include a NumPages \
> 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/value pair, \
> the consumer must ignore it. 
> Recap: design your XML so that the root element contains 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. 
> /Roger
> 


[Attachment #3 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space;"><div>A variant of this is the XSLT \
"forwards compatibility" policy where unknown elements and attributes are ignored if \
and only if the version number on the document instance is greater than the version \
number of the application/processor. The benefit of this is that you can combine the \
extensibility goal with the goal of detecting errors (e.g. misspelled element \
names)</div><br><div apple-content-edited="true"> <div style="color: rgb(0, 0, 0); \
letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; \
text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; \
-webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space;"><div>Michael \
Kay</div><div>Saxonica</div><div><a \
href="mailto:mike@saxonica.com">mike@saxonica.com</a></div><div>+44 (0) 118 946 \
5893</div><div><br></div></div><br class="Apple-interchange-newline"><br \
class="Apple-interchange-newline">

</div>
<br><div><div>On 29 Apr 2015, at 14:39, Costello, Roger L. &lt;<a \
href="mailto:costello@mitre.org">costello@mitre.org</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite">

<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]-->

<div 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 "Must-Ignore" 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 "Must-Understand" 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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: \
12pt; font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"> 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: \
12pt; font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: 12pt; font-family: 'Times New Roman', \
serif;">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: \
12pt; font-family: 'Times New Roman', serif;"><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: 12pt; \
font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"><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: \
12pt; font-family: 'Times New Roman', serif;">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: 12pt; \
font-family: 'Times New Roman', serif;"> 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: \
12pt; font-family: 'Times New Roman', serif;"><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> </div>

</blockquote></div><br></body></html>



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

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