RE: XML within XML - includes, transcludes, whatever

> The problem is that when parsing I can't do the following
> (simplifying the XML terribly):
>
> <wrapper with wrapper.dtd>
>    <header> ... </header>           -- elements defined by wrapper.dtd
>    <body>
>       <newsml with newsml.dtd>      -- start of new enclosed document
>          <headline> ... </headline> -- elements defined by newsml.dtd
>          <body> ... </body>
>       </newsml>                     -- return to wrapping document context
>    </body>
> </wrapper>
>
> Where the wrapper.dtd doesn't know about newml, newsml.dtd doesn't know
> about the wrapper, and both chunks of XML are validated.

I think this is very much a question of layering. If you try to validate
the document *in toto* you'll have trouble. I have always felt that
parsing and validation are separate things, so I could quite easily
imagine doing this:

  <wrapper>
  <header>
    <field name="id" value="12345678">
  </header>
  <body>
    <anything>
      <can>
        <go>
          <here>
          </here>
        </go>
      </can>
    </anything>
  </body>
  </wrapper>

and then validating the various bits separately. For example, validating the
content of <header> is important, and validating the *content* of <body>
is important. We can validate those two, seperately using the idea that
validation is basically a boolean function

   validate(node, content-model)

where "content-model" would be a different DTD for <header> and
the content of <body>. In other words, read in the XML as a well-formed
document, then apply validation to the bits you care about. The only
thing you'd have to be a little careful of was namespaces.

Received on Wednesday, 1 November 2000 12:52:35 UTC