Summary: What is an "integer" in the text-only XML data format?
Roger L Costello <[email protected]> Thu, 30 Mar 2023 11:27:22 +0000
| Newsgroups | gmane.text.xml.devel |
|---|---|
| Message-ID | <SA9PR09MB59520528375B46EA563AFB2AC88E9@SA9PR09MB5952.namprd09.prod.outlook.com> |
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 _______________________________________________________________________ XML-DEV is a publicly archived, unmoderated list hosted by OASIS to support XML implementation and development. To minimize spam in the archives, you must subscribe before posting. [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ Or unsubscribe: [email protected] subscribe: [email protected] List archive: http://lists.xml.org/archives/xml-dev/ List Guidelines: http://www.oasis-open.org/maillists/guidelines.php