ifc-xml
The ifcXML (ISO 10303-28) codec for the IFC model: the same ifc_model::Codec
trait as ifc-step, over the same model. Two layouts:
- Its own lossless layout, read and written. With a schema it writes
conformant named attributes and reads strictly: every value is typed from
its declaration (
Name="1"is a label, not an integer) and a name the entity does not declare is a typed error, never a value in a free slot.SchemaReading::Lenientrestores inference. Without a schema it falls back to marked positional names; both round-trip losslessly. - The buildingSMART XSD configuration of IFC4 ADD2 TC1 and IFC4X3 ADD2,
read and written (
XmlCodec::xsd): nested and inline entities,ref/hrefreferences, inverse attributes,-wrappertyped values and list attributes, read into the same model as the document's STEP form. The writer writes that model back as a document that validates againstIFC4.xsdand reads back to the same model. Each attribute's form comes from one derivation both share, checked against both XSDs. What either direction cannot carry exactly is refused with a typed error (XmlError::Unrepresentablefor a model the configuration cannot represent), never approximated.
A strict release profile (XmlCodec::strict, with_schema_and_profile)
fixes the namespace and schema token of the native layout; it does not make
the output valid against the release XSD, and does not claim to. Use
XmlCodec::xsd for that.
Checking output against the official XSD
An opt-in test validates output with xmllint (libxml2) against the release
XSD. Every IFC4 fixture written with XmlCodec::xsd must validate with no
error. Strict native output must be well-formed, rooted in the XSD's
ifcXML element and target namespace, and depart only as documented (the
schema root attribute, upper-case entity elements, the header order). The
published IFC4X3_ADD2.xsd does not compile in any conforming validator,
which the test records; for that release it checks well-formedness and the
namespace. The XSDs are CC BY-ND 4.0 and never committed; normal builds and
the gate do not need them, the network or xmllint. Once run, anything
missing is a failure:
The openbim-ifc facade also provides it behind its
ifcxml feature.
- API documentation: docs.rs/ifc-xml
- Reference page: openbimrs.github.io/ifc
- Source and issues: github.com/openbimrs/ifc