OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   What is a Compound Document?

[ Lists Home | Date Index | Thread Index ]
  • To: "'XML Developers List'" <xml-dev@lists.xml.org>
  • Subject: What is a Compound Document?
  • From: "Roger L. Costello" <costello@mitre.org>
  • Date: Fri, 28 Jan 2005 10:59:22 -0500
  • In-reply-to: <41F9EAF7.3020208@allette.com.au>
  • Thread-index: AcUFE5an4l6TesOGSuyQo55wzX98hgAOPzCQ

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







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS