private function addUnits( &$document )
	{
		foreach ( $this->units as $unitRef => $unit )
		{
			$entry = array();
			$entry[] = "  <unit id=\"$unitRef\">";

			if ( isset( $unit['divide'] ) )
			{
				$entry[] = "    <divide>";

				if ( isset( $unit['divide']['numerator'] ) && count( $unit['divide']['numerator'] ) )
				{
					$entry[] = "      <unitNumerator>";

					foreach ( $unit['divide']['numerator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitNumerator>";
				}

				if ( isset( $unit['divide']['denominator'] ) && count( $unit['divide']['denominator'] ) )
				{
					$entry[] = "      <unitDenominator>";

					foreach ( $unit['divide']['denominator'] as $measure )
					{
						$entry[] = "        <measure>$measure</measure>";
					}

					$entry[] = "      </unitDenominator>";
				}

				$entry[] = "    </divide>";
			}
			else if ( isset( $unit['measures'] ) )
			{
				foreach ( $unit['measures'] as $measure )
				{
					$entry[] = "    <measure>$measure</measure>";
				}
			}
			else
			{
				$xbrli = STANDARD_PREFIX_XBRLI;
				$unit = str_replace( "{$xbrli}:", "", $unit );
				$entry[] = "    <measure>$unit</measure>";
			}
			$entry[] = "  </unit>";
			$entry[] = "";

			$document[] = implode( "\n", $entry );
		}
	}