| title | Get Started |
|---|---|
| description | Quick-start guide for using UnitsML |
Everything you need to start using UnitsML in your projects — whether you're encoding units in XML, browsing schemas, or integrating the units database programmatically.
Use UnitsML schemas to encode units in your XML documents.
Explore schema definitions interactively at schema.unitsml.org.
Use the unitsml-ruby gem to query UnitsDB from your applications.
The UnitsML XML Schema defines how to encode units of measure in XML documents. Here's how to get started:
Add the UnitsML namespace to your XML document:
<YourDocument
xmlns:unitsml="https://schema.unitsml.org/unitsml/1.0"
xsi:schemaLocation="https://schema.unitsml.org/unitsml/1.0
https://schema.unitsml.org/unitsml/unitsml-v1.0.xsd"><unitsml:UnitSet>
<unitsml:Unit xml:id="m" dimensionURL="#L">
<unitsml:UnitName>metre</unitsml:UnitName>
<unitsml:UnitSymbol>SI</unitsml:UnitSymbol>
</unitsml:Unit>
</unitsml:UnitSet><Measurement>
<Value unitsml:unit="#m">9.81</Value>
<Description>Gravitational acceleration</Description>
</Measurement>::: tip UnitsML is designed to be incorporated into other markup languages, not used standalone. The models work best when embedded in domain-specific formats like MatML, CML, or your own vocabulary — and can also be expressed in JSON, YAML, and other formats. :::
The interactive schema browser provides documentation for all UnitsML schema components:
Browse element definitions, type hierarchies, and schema documentation for all versions.
Use the unitsml-ruby gem to query UnitsDB from Ruby applications:
gem install unitsml-rubyrequire 'unitsml'
# Find a specific unit
unit = Unitsml::Units.find("m")
puts unit.name # => "metre"
puts unit.symbol # => "m"See the unitsml-ruby page for full API documentation.
- Read the UnitsML Guide for in-depth usage patterns
- Learn how to incorporate UnitsML into other markup languages
- Understand what UnitsML is and the problems it solves
- Explore UnitsDB — the complete units database