Class Index | File Index

## Classes

- _global_
- jQuery
- jQuery.rdf
- jQuery.rdf.blank
- jQuery.rdf.databank
- jQuery.rdf.literal
- jQuery.rdf.pattern
- jQuery.rdf.resource
- jQuery.rdf.rule
- jQuery.rdf.ruleset
- jQuery.rdf.triple
- jQuery.typedValue
- jQuery.uri

# Class jQuery.typedValue

Represents a value with an XML Schema datatype
Defined in: jquery.datatype.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| jQuery.typedValue(value, datatype) Creates a new jQuery.typedValue object.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| datatype The XML Schema datatype URI for the value's datatype
| representation The string representation of the value
<static> | jQuery.typedValue.types An object that holds the datatypes supported by the script.
| value The value as an object.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | jQuery.typedValue.valid(value, datatype) Checks whether a value is valid according to a given datatype.

Class Detail
jQuery.typedValue(value, datatype)
Creates a new jQuery.typedValue object. This should be invoked as a method rather than constructed using new.

    intValue = jQuery.typedValue('42', 'http://www.w3.org/2001/XMLSchema#integer');

Parameters:
{String} value
  The string representation of the value
{String} datatype
  The XML Schema datatype URI

Returns:
  {jQuery.typedValue}

Field Detail
datatype
The XML Schema datatype URI for the value's datatype

representation
The string representation of the value

<static> jQuery.typedValue.types
An object that holds the datatypes supported by the script. The properties of this object are the URIs of the datatypes, and each datatype has four properties:

strip
  A boolean value that indicates whether whitespace should be stripped from the value prior to testing against the regular expression or passing to the value function.
regex
  A regular expression that valid values of the type must match.
validate
  Optional. A function that performs further testing on the value.
value
  A function that returns a Javascript object equivalent for the value.

You can add to this object as necessary for your own datatypes, and jQuery.typedValue and jQuery.typedValue.valid will work with them.

See:
  jQuery.typedValue
  jQuery.typedValue.valid

value
The value as an object. The type of the object will depend on the XML Schema datatype URI specified in the constructor. The following table lists the mappings currently supported:

XML Schema Datatype | Value type
--- | ---
http://www.w3.org/2001/XMLSchema#string | string
http://www.w3.org/2001/XMLSchema#token | string
http://www.w3.org/2001/XMLSchema#NCName | string
http://www.w3.org/2001/XMLSchema#boolean | bool
http://www.w3.org/2001/XMLSchema#decimal | string
http://www.w3.org/2001/XMLSchema#integer | int
http://www.w3.org/2001/XMLSchema#int | int
http://www.w3.org/2001/XMLSchema#float | float
http://www.w3.org/2001/XMLSchema#double | float
http://www.w3.org/2001/XMLSchema#dateTime | string
http://www.w3.org/2001/XMLSchema#date | string
http://www.w3.org/2001/XMLSchema#gYear | int
http://www.w3.org/2001/XMLSchema#gMonthDay | string
http://www.w3.org/2001/XMLSchema#anyURI | jQuery.uri

Method Detail
<static> {boolean} jQuery.typedValue.valid(value, datatype)
Checks whether a value is valid according to a given datatype. The datatype must be held in the jQuery.typedValue.types object.

    validDate = $.typedValue.valid(date, 'http://www.w3.org/2001/XMLSchema#date');

Parameters:
{String} value
  The value to validate.
{String} datatype
  The URI for the datatype against which the value will be validated.

Returns:
  {boolean} True if the value is valid or the datatype is not recognised.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Feb 04 2011 16:40:11 GMT+0100 (MEZ)