[Philosophical] What is an XML document?

Roger L Costello <[email protected]>
Newsgroups gmane.text.xml.devel
Message-ID <SA9PR09MB5952C5C8CB105B452BCA2DFDC8A09@SA9PR09MB5952.namprd09.prod.outlook.com>
Hi Folks,

There is a file on my laptop that consists exclusively of these characters:

<Greeting>Hello, world!</Greeting>

Question: Is the file an XML document?

Answer: No, it is simply a text file.

Evidence to support my answer: I opened Notepad, dragged and dropped the file into Notepad, and subsequently Notepad displayed the file's content as a linear sequence of characters, i.e., text.

Philosophical Discussion: 

An XML document is "in the eye of the beholder." That is, to Notepad my file is just text, but to Apache Xerces my file has a structure consistent with the XML specification and therefore -- to Xerces -- it is an XML document.

In order for a file to be considered an XML document, two things must align:

1. The application assessing the file must have internalized the grammar rules specified in the XML specification.

2. The application must process the file to determine that the file has a structure consistent with the grammar rules.

Only if 1 and 2 are satisfied may the application pronounce "Yes, this is an XML document."

Let's dig a bit deeper...

Clearly the following is a linear sequence of characters:

<Greeting>Hello, world!</Greeting>

It only becomes an XML document when an XML-aware application has processed it (assessed it) and determined compliance with the XML grammar. The most common method of determining if an input string conforms to a grammar is to lexically analyze the string into tokens and then see if the tokens matches a specified grammar; along the way an in-memory "parse tree" is created. If we successfully create a complete parse tree, then we have an XML document. If we have an XML document, then we have successfully created a complete parse tree. An XML document is a parse tree.

No one would deny that a parse tree is a "data structure." Therefore an XML document is a data structure.

Do you agree with my line of reasoning? Where does my logic go astray?

/Roger



_______________________________________________________________________

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.