Skip to main content

Search 400 pages — tools, formats, elements, namespaces, directory, comparisons, XPath, datatypes, glossary, parse errors, schema errors, use cases, guides, blog and product.

XSD datatype

xs:unsignedByte

An integer from zero to 255, the XSD type that actually models an octet value.

xs:unsignedByte covers 0–255. Despite the name, it is still serialized as decimal text and does not assert anything about the document's byte encoding.

Lexical space
Optional plus sign and digits within 0 to 255.
Derives from
xs:unsignedShort
Category
Numeric types
Facets
minInclusive, maxInclusive, minExclusive, maxExclusive, pattern, enumeration, whiteSpace, totalDigits, fractionDigits

What validates

Every literal below is put through the schema validator on each test run, against the schema at the foot of this page.

  • 0
  • 255
  • +1

What does not

  • -1

    Unsigned values cannot be negative.

  • 256

    One past the maximum.

What catches people out

  • This is the 0–255 type; xs:byte is -128–127.
  • The lexical representation is decimal characters, not raw binary.
  • Use base64Binary or hexBinary for a sequence of octets.

The schema used

This is the exact schema the literals above are validated against. Paste it into the validator with one of them to see the result yourself.

schema.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="v" type="xs:unsignedByte"/>
</xs:schema>

Open the XSD validator

Related

All 39 datatypes and facets

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.