Constructor for creating a new xsd:hexBinary literal
mixed $value The value of the literal (already encoded as hexadecimal):
string $lang Should be null (literals with a datatype can't have a language):
string $datatype Optional datatype (default 'xsd:hexBinary'):
object EasyRdf_Literal_HexBinary
Overrides EasyRdf_Literal::__construct
public function __construct($value, $lang = null, $datatype = null) {
// Normalise the canonical representation, as specified here:
// http://www.w3.org/TR/xmlschema-2/#hexBinary-canonical-repr
$value = strtoupper($value);
// Validate the data
if (preg_match("/[^A-F0-9]/", $value)) {
throw new InvalidArgumentException("Literal of type xsd:hexBinary contains non-hexadecimal characters");
}
parent::__construct(strtoupper($value), null, 'xsd:hexBinary');
}