xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett McLaughlin <bmcla...@algx.net>
Subject Re: XML Inheritance Extentions (first try)
Date Mon, 20 Dec 1999 07:12:15 GMT


Stefano Mazzocchi wrote:
<snip/>
> 
> A working proposal
> 
>   Let us suppose we have a template XML document that looks like this:
> 
> <page>
>   <title/>
>   <author>John Smith</author>
>   <body/>
>   <legal>Copyright (c) 1999 John Smith. All rights reserved.</legal>
> </page>
> 
>   We would like our document to "extend" the template one to "inherit"
> some of its structure, allowing to minimize content replication and to
> centralize a point of update that gets automatically reflected to all
> the extending documents.
> 
>   For example, a final document is something like this:
> 
> <page>
>   <title>Home Page</title>
>   <author>John Smith</author>
>   <body>
>    <p>Hi, welcome to my home page.</p>
>   </body>
>   <legal>Copyright (c) 1999 John Smith. All rights reserved.</legal>
> </page>
> 
>   where we clearly see major overlap between the two documents.
> 
>   Let's try with the following document:
> 
> <page xml:extends="template.xml">
>   <title>Home Page</title>
>   <body>
>    <p>Hi, welcome to my home page.</p>
>   </body>
> </page>
> 
>   might be transformed in the one above with a simple "merging"
> algorithm that "overwrites" existing elements (in their locations) with
> the elements (and their substructure) defined in the extending document.

I think one of the most significant items missing from this is details
about namespace.  For example, in your example:

> <page>
>   <title/>
>   <author>John Smith</author>
>   <body/>
>   <legal>Copyright (c) 1999 John Smith. All rights reserved.</legal>
> </page>

It is fairly reasonable to assume that this template could be extended
by hundreds of pages across a website, and possible across multiple
websites (part of the same company).  So I would want to be able to
assign different namespaces to these variants:

<contents:page xml:extends="template.xml">
  <contents:title>Table of Contents</contents:title>
  <contents:body>
    <p>Hi, welcome to the table of contents.</p>
  </contents:body>
</contents:page>

and:

<chapter:page xml:extends="template.xml">
  <chapter:title>Chapter One: Introduction</chapter:title>
  <chapter:body>
    <p>Here is content of Chapter One</p>
  </chapter:body>
</chapter:page>

This allows the same template to be used many places, and still handle
inclusions.  For example, my contents:page might include portions of
various chapter:page documents, making namespace support critical.  How
would this be handled?  This is the problem I was referring to earlier
when I said that you should be able to easily map namespaces onto XML
documents.  In this case, you would want an initial run through the
document to ignore the namespace, handling only [XML_1] and [XML_2]
where XML_1 is the original document (template) and XML_2 is the
extending document, minus the namespace.  Then it would be the same
scenario as you proposed.  At the end of the extension processing, you
could simply perform A * [XML_2] where A is the desired namespace to
achive the final XML document, with namespace support, but without
additional strange processing having to go on.

Of course the complexity increases with multiple namespaces in
documents.  But let's wait on that until I get feedback on this first
comment.  What do you think?  I see this as a serious need for inclusion
in the note.

-Brett

Mime
View raw message