XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Summary: What is an "integer" in the text-only XML data format?

Consider an XML Schema with this top-level element declaration:

<xs:element name="num" type="xs:integer"/>

And an XML file that contains this:

<num>44</num>

Question: What is the content of the <num> element? An integer? A string?

Answer: The content of the <num> element is an integer which is represented by the string 44.

Explanation: The XML Schema xs:integer type has a value space and a lexical space. The value space is the set of the actual mathematical integers. The lexical space is the set of strings that represent the integers. Specifically, the lexical space is the set of strings that match this regex:  

	[+-]?[0-9]+ 

The lexical mapping of xs:integer maps each string representation (also called a literal, this is what appears in XML as text) to an integer value in the value space.

The string 44 matches the regex. Therefore it is in the lexical space of xs:integer and therefore it represents the corresponding integer. 

Acknowledgements

Thank you to the following people for their contribution to this discussion:

Roger Costello
Peter Flynn 
Ghislain Fourny
Michael Sperberg-McQueen


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS