* The type xsd:string represents a character string that may contain any Unicode character allowed by XML. Certain characters, namely the "less than" symbol (<) and the ampersand (&), must be escaped (using the entities < and &, respectively) when used in strings in XML instances.
13
*
14
* The xsd:string type has a whiteSpace facet of preserve, which means that all whitespace characters (spaces, tabs, carriage returns, and line feeds) are preserved by the processor. This is in contrast to two types derived from it: normalizedString, and token.
15
* Valid values Comment
16
* "This is a string!"
17
* "Édition française."
18
* "12.5
19
* :an empty string is valid
20
* "PB&J" :when parsed, it will become "PB&J"
21
* "This
22
* is on two lines."
23
* Invalid values Comment
24
* "AT&T" ampersand must be escaped
25
* "3 < 4" the "less than" symbol must be escaped
26
* But most of that should be handled by JSM
27
*
28
* @package AlgoWeb\xsdTypes
29
*/
30
class xsString extends xsAnySimpleType
31
{
32
/**
33
* Construct
34
*
35
* @param mixed $value
36
*/
37
public function __construct($value)
38
{
39
parent::__construct($value);
40
$this->setWhiteSpaceFacet("preserve");
41
}
42
protected function fixValue($value)
43
{
44
return $value;
45
}
46
47
protected function isOK($value)
48
{
49
if (is_array($value) || is_object($value)) {
50
throw new \InvalidArgumentException(
51
"the provided value for " . __CLASS__ . " is should not be an array or an object: "