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] What does "optional" mean?

At 2012-02-26 16:54 +0000, Michael Kay wrote:
>On 26/02/2012 14:11, Costello, Roger L. wrote:
>>Hi Folks,
>>Every schema language (DTD, XSD, RNG) has the 
>>notion of optional -- optional elements and optional attributes.
>>But what does it mean to declare an element or attribute optional?

I think it only means that it is permitted not to 
include the item in the document ... nothing 
more.  Any other meaning is in the eye of the beholder.

>Just as the attribute iubce='qwudob' means 
>whatever the sender and recipient agree it 
>should mean, so equally the absence of the iubce 
>attribute means whatever the sender and 
>recipient agree it to mean, which might be "I 
>don't know", or "not applicable", or "I don't 
>think you want to know this", or "you already 
>know this so I'm not telling you again", or 
>perhaps it means exactly the same as iubce='qwudob'.

Interestingly, there is a rule in UBL that empty 
elements or meaningly absent elements are not 
allowed ... below is a quote from the UBL 2.0 
specification.  The one exception is the 
extension point as it is possible in an 
implementation to prune unknown foreign 
constructs under the extension point, thus 
leaving the extension point itself empty.

I hope this helps.

. . . . . . . . . . . Ken

6.3. Empty Elements

Use of empty elements within XML instance 
documents is a source of controversy for a 
variety of reasons. An empty element does not 
simply represent data that is missing. It may 
express data that is not applicable for some 
reason, trigger the expression of an attribute, 
denote all possible values instead of just one, 
mark the end of a series of data, or appear as a 
result of an error in XML file generation. 
Conversely, missing data elements can also have 
meaning  data not provided by a trading partner. 
In information exchange environments, different 
trading partners may allow, require, or ban empty 
elements. UBL has determined that empty elements 
do not provide the level of assurance necessary 
for business information exchanges and therefore will not be used.

     [IND5] UBL conformant instance documents 
MUST NOT contain an element devoid of content or 
containing null values, except in the case of 
extension, where the UBL ExtensionContent element is used.

To ensure that no attempt is made to circumvent 
rule IND5, UBL also prohibits attempting to 
convey meaning by not conveying an element.

     [IND6] The absence of a construct or data in 
a UBL instance document MUST NOT carry meaning.

Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
G. Ken Holman                   mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

[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