buildingSMART Forums

XSD Optional Attributes

Devon has raised an issue about optional XSD attributes here:

This has been puzzling me too, but the best explanation I’ve heard/identified is that by making all attributes optional, you can use xml validation tools when taking advantage of xml href for common references. Not this isn’t specific just to this attribute, I can see in IfcDoc all attributes are forced to be optional.

Below is a sample of ifcxml. Note that the properties are defined within the first IfcRelDeclares, and then referenced within the property set template definition. If the GlobalID attributes is required, then notepad++ validation tool fails this. I’m not an expert in xml, but I assume there has to be a better way to handle this?

<?xml version="1.0" encoding="utf-8"?>
<ifcXML xmlns:xsi="" xmlns="" xsi:schemaLocation="">
	<IfcProjectLibrary GlobalId="0xNUMqo4v2JQgvm1eG8byl" Name="DemoLibrary">
			<IfcRelDeclares GlobalId="1p$MsXBQP4fRog0yDp8OSD" Name="Properties">
					<IfcSimplePropertyTemplate id="MyProperty1_3eWOEVX55F2v9g_SnOYB3V" GlobalId="3eWOEVX55F2v9g_SnOYB3V" Name="MyProperty1" TemplateType="p_singlevalue" PrimaryMeasureType="IfcLabel" />
					<IfcSimplePropertyTemplate id="MyProperty2_104NlF0cH7JhA_NN2cERA" GlobalId="104NlF0cH7JhA_NN2$cERA" Name="MyProperty2" TemplateType="p_singlevalue" PrimaryMeasureType="IfcLabel" />
			<IfcRelDeclares GlobalId="2bm9EKgi9Cxh48FZsSQWev" Name="PropertySets">
					<IfcPropertySetTemplate GlobalId="01h32OutHFgxkDsa4HdM$w" Name="MyPropertySet" TemplateType="pset_occurrencedriven" ApplicableEntity="IfcSystem">
							<IfcSimplePropertyTemplate xsi:nil="true" href="MyProperty1_3eWOEVX55F2v9g_SnOYB3V" />
							<IfcSimplePropertyTemplate xsi:nil="true" href="MyProperty2_104NlF0cH7JhA_NN2cERA" />

There was this discussion in Github where we had a proposal with minOccurs and maxOccurs.

Thanks both. These links do a good job at capturing the problem. How to go about fixing it?

  1. Do nothing. There may be good reason for the existing spec being the way it is.

  2. Use minOccurs=1 on required attribute references like GlobalId

  • (Appears to be a) relatively small change to schema output
  • Conceptually unclean because use=“optional” attributes aren’t really.
  1. Use xsd:unique and xsd:keyref in place of ID/IDREF
  • More flexibility in joining elements vs ID/IDREF
  • key maps need to be “in scope” of the elements that use them, meaning most of the keys would probably need to bloat something like uos:ifc
  • can’t make use of substitution groups afaik
  1. Use the approach outlined in ISO 10303-28, with either early or late binding, to create distinct types for references.

Late binding (ISO 10303-28, Section 7.4.4):

Early binding (ISO 1303-28, Section 8.1.2):


  • Avoids conflicts between required attributes because instance declaration and reference are made from separate types.
  • Every entity now has a corresponding reference type, increasing the size of the schema.

The approach suggested in ISO 10303-28 seems reasonable. What were the design decisions against adopting this approach?

Other perspectives/ideas?

Thanks! – Devon