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

What is a Compound Document?

  • To: "'XML Developers List'" <xml-dev@l...>
  • Subject: What is a Compound Document?
  • From: "Roger L. Costello" <costello@m...>
  • Date: Fri, 28 Jan 2005 10:59:22 -0500
  • In-reply-to: <41F9EAF7.3020208@a...>
  • Thread-index: AcUFE5an4l6TesOGSuyQo55wzX98hgAOPzCQ

what is a compound document
Hi Folks,

I am still unclear on what a compound document is.  

1. What is a compound document?

A compound document is an XML document comprised of elements from
independently developed schemas.  For example, an XML document that is
comprised of elements from the SVG schema and elements from the XHTML schema
is a compound document.

2. How is this different from an instance document that conforms to an XML
Schema that uses the <any/> element ?

Suppose that my Book schema uses an <any/> element after the declaration for
Title:

targetNamespace="http://www.books.org"

<element name="Book">
   <complexType>
      <sequence>
         <element name="Title" type="string"/>
         <any namespace="##other"/>
         <element name="Author" type="string"/>
         <element name="Date" type="string"/>
         <element name="ISBN" type="string"/>
         <element name="Publisher" type="string"/>
      </sequence>
   </complexType>
</element>

This declaration of Book states that "After the Title element you can have
any element from any other namespace".

So, an XML document could thus contain elements from the book namespace and
the XHTML namespace:

<Book xmlns="http://www.books.org">
   <Title>The First and Last Freedom</Title>
   <HTML xmlns="http://www.w3.org/TR/REC-xhtml">
       <BODY>Hello World</BODY>
   </HTML>
   <Author>J. Krishnamurti</Author>
   <Date>1954</Date>
   <ISBN>0-06-064831-7</ISBN>
   <Publisher>Harper &amp; Row</Publisher>
</Book>

Is this a compound document?  It meets the above definition, i.e., the
instance document is comprised of elements from independently developed
schemas and namespaces.

I am guessing that it is not a compound document.  True? 

I am guessing that a compound document entails more than simply an instance
document comprised of elements from multiple vocabularies.

I am guessing that if the Book schema were declared without the <any/>
element, e.g.,

targetNamespace="http://www.books.org"

<element name="Book">
   <complexType>
      <sequence>
         <element name="Title" type="string"/>
         <element name="Author" type="string"/>
         <element name="Date" type="string"/>
         <element name="ISBN" type="string"/>
         <element name="Publisher" type="string"/>
      </sequence>
   </complexType>
</element>

And an instance document inserted an XHTML element after the Title element:

<Book xmlns="http://www.books.org">
   <Title>The First and Last Freedom</Title>
   <HTML xmlns="http://www.w3.org/TR/REC-xhtml">
       <BODY>Hello World</BODY>
   </HTML>
   <Author>J. Krishnamurti</Author>
   <Date>1954</Date>
   <ISBN>0-06-064831-7</ISBN>
   <Publisher>Harper &amp; Row</Publisher>
</Book>

Then this instance document is a compound document.  Is this true?

If so, then by definition a compound document cannot be validated by an XML
Schema validator.  Correct?  For example, an XML Schema validator would
reject the above instance document, saying "invalid element after Title,
expecting Author".

So, what is a compound document?

/Roger




PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.