Basic data types
Stay organized with collections
Save and categorize content based on your preferences.
The following general requirements apply to the content and format of basic
data types in the XML specification.
xs:string
Trim any excess whitespace before or after the string.
To aid readability, if you present a lowercase string like tornado warning
to end users, then convert the data to title case, when possible. In other
words, change tornado warning
to Tornado Warning
.
Don't use unsupported punctuation, and use XML escape characters when
appropriate. For example, use &
instead of &
.
xs:dateTime
Use ISO-8601 format in the form of YYYY-MM-DDThh:mm:ssXzh:zm
, defined as
follows:
YYYY
indicates the year.
MM
indicates the month.
DD
indicates the day.
T
indicates the symbol "T" and marks the start of the required time section.
hh
indicates the hour.
mm
indicates the minute.
ss
indicates the second.
X
indicates one of these symbols:
"+" if the preceding date and time are in a time zone ahead of UTC.
"-" if the preceding date and time are in a time zone behind UTC, or if the
time is in UTC.
zh
indicates the hours of offset from the preceding date and time to UTC, or
00
if the preceding time is in UTC.
zm
indicates the minutes of offset from the preceding date and time to UTC,
or 00
if the preceding time is in UTC.
As an example, for May 24, 2002 at 16:49 PDT, use 2002-05-24T16:49:00-07:00
.
Don't use alphabetic time zone designations like "Z." You must represent the
time zone for UTC as -00:00
.
xs:language
As described in the CAP standard, represent languages by a valid RFC 3066
identifier. We recommend that you designate only primary language tags in
lowercase.
An example is en-US
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[[["Basic data types in XML, such as strings, dates/times, and languages, must adhere to specific formatting and content requirements."],["Strings should be trimmed, presented in title case when appropriate for readability, and utilize XML escape characters for special characters."],["Dates and times must follow the ISO-8601 format (`YYYY-MM-DDThh:mm:ssXzh:zm`), including specific time zone offsets from UTC."],["Language codes should conform to RFC 3066, preferably using lowercase primary language tags (e.g., `en-US`)."]]],["XML data type requirements include specific formatting for strings, date/times, and languages. Strings must have leading/trailing whitespace trimmed, be converted to title case for display when possible, and use XML escape characters. Date/times require ISO-8601 format (`YYYY-MM-DDThh:mm:ssXzh:zm`) and avoid alphabetic time zone designations, instead using `+`, `-`, `00:00`. Languages should adhere to RFC 3066 identifiers, primarily using lowercase tags like `en-US`.\n"]]