[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: The text illusion

  • From: "Simon St.Laurent" <simonstl@simonstl.com>
  • To: xml-dev@lists.xml.org
  • Date: Fri, 15 Jul 2016 09:23:04 -0400

Re:  The text illusion

The problem isn't text - it's context, or lack thereof.

Thanks,
Simon


On 7/15/2016 9:09 AM, Michael Kay wrote:
All you are really telling us is that you don't know the meaning of a piece of XML just by looking at it; you need to know the representation conventions. Obviously <altitude>10</altitude> could mean 10 metres, or 10 feet, or 10 Km, or 10 miles, or even 5010 feet, and it could be height above mean sea level in Greenwich or above the summit of Kilamanjaro. That's hardly a new insight, and hardly something that needs a pseudo-mathematical proof.

Michael Kay
Saxonica

On 15 Jul 2016, at 12:52, Costello, Roger L. <costello@mitre.org> wrote:

Hi Folks,

What is the altitude?

           <altitude>0</altitude>

 

The altitude is zero (0), right?

 

No, the altitude is 48. I will now prove it.

 

The content (value) of <altitude> is a single character and that character is represented by hex 30. You can see this if you open the XML in a hex editor:

<image001.png>

 

Note: hex 30 equals decimal 48.

So, if we interpret the value of <altitude> as a bunch of bits representing a number, then the answer to the question is this: The altitude is 48.

Q.E.D.

My “proof” is flawed. My proof assumed the bits within <altitude> represents a number. However, bits can represent anything. XML chooses to represent all bits as an encoding of characters. In the ASCII character encoding scheme, the bits 0011 0000 (hex 30) represent the character ‘0’. So the altitude is ‘0’.

Now, you might want to convert the character ‘0’ to a number (cast the value of <altitude> to a number). Such a converter will need to know (a) the bits are an encoding of a character, (b) the bits are an encoding of an ASCII character (and not, say, an EBCDIC character), (c) the character is a character version of a digit (e.g., ‘0’ is a character version of the digit 0), and (d) how to convert the character digit to a numeric digit.

Lesson Learned: When you look at XML you might think you are seeing numbers but you are not. It’s an illusion. You are merely seeing characters.

/Roger

 





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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.