[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Summary: What is an "integer" in the text-only XML data format?
- From: Roger L Costello <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Thu, 30 Mar 2023 11:27:22 +0000
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]