public static function fromString( $string )
	{
		// Make sure the string does not contain non-hex characters
		$matched = preg_match( "/[^0-9a-fA-F]+/", $string, $matches );
		if ( $matched || strlen( $string ) % 2 != 0 )
		{
			throw XPath2Exception::withErrorCodeAndParams( "FORG0001", Resources::InvalidFormat, array( $string, "xs:hexBinary" ) );
		}

		$binary = hex2bin( $string );
		return new HexBinaryValue( $binary );
	}