Name
rng:data — Matches data of a given datatype
XML syntax example
<element name="num"> <data type="decimal" datatypeLibrary="http://www.w3.org/2001/XMLSchema- datatypes"> <param name="minInclusive">0.0</param> <param name="maxInclusive">1.0</param> </data> </element>
Compact syntax example
element num {
xsd:decimal
{ minInclusive = "0.0" maxInclusive = "1.0" }
}
Parents
attribute
, choice
((
)
and |
), define
(name of pattern followed by
=
), element
, except
(-
), group
((
)
and ,
), interleave
(&
), list
, mixed
, oneOrMore
(+
), optional
(?
), start
(start
followed by =
), zeroOrMore
(*
)
Attributes
type
A datatype from the datatype library specified with the nearest
datatypeLibrary
attribute
Description
The data
pattern matches
any legal value of a specified datatype. An external datatype
library, such as the XML Schema datatype library, defines the
datatype. The datatype library is specified by the value of the
datatypeLibrary
attribute. Child
or descendent elements inherit the value of datatypeLibrary
; hence datatypeLibrary
is often specified on the
document element. Datatypes can be restricted using the param
element. In the compact syntax,
datatypes are specified by a name with a prefix. If no value is
given for datatypeLibrary
, RELAX
NG defaults to a built-in datatype library with only two types:
string
and token
. You can remove a value or a subtype
from a datatype by using except
.
See also
§5, except
, list
, param
Get XML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.