Section 20.6.  Document XML document and instance

Prev don't be afraid of buying books Next

20.6. Document, XML document, and instance

The term document has two distinct meanings in XML.

Consider a really short XML document that might be rendered as:

Hello World

The conceptual document that you see in your mind's eye when you read the rendition is intuitively what you think of as the document. Communicating that conception is the reason for using XML in the first place.

In a formal, syntactic sense, though, the complete text (markup + data, remember) of Example 20-2, is the XML document. Perhaps surprisingly, that includes the markup declarations for its DTD (shown in Example 20-1). The XML document, in other words, is a character string that represents the conceptual document.[2]

[2] After a program parses the string it usually keeps an object model in memory so that it can navigate and access data directly in terms of the conceptual document structure. During processing it usually updates the object model, then serializes it as the result XML document.

Example 20-2. A greeting document.
 <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "file://greeting.dtd"> <greeting> <salutation>Hello</salutation> <addressee>World</addressee> </greeting> 

In this example, much of that string consists of the markup declarations, which express the greeting DTD. Only the last four lines describe the conceptual document, which is an instance of a greeting. Those lines are called the document instance.

That term gets flipped around when schema languages are involved. Unlike DTD declarations, schema languages are XML-based, so a schema definition must be stored as an XML document in its own right (a schema document). That means an instance of a schema definition is a separate document, so it is known as an instance document.

Amazon


XML in Office 2003. Information Sharing with Desktop XML
XML in Office 2003: Information Sharing with Desktop XML
ISBN: 013142193X
EAN: 2147483647
Year: 2003
Pages: 176

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net