Re: CM: DocumentCM.getInternalCM()

Sander Bos wrote:

> Hi there,
>
> I have a question concerning the content model specification, about
> getInternalCM defined on DocumentCM. I suppose the content model returned by
> this method represents the internal subset of the document (the method is
> defined as the 'sole CMModel')?

Yes, it's the internal subset that's returned.

>
>
> I wonder how this works out in practice.
>
> If you have a document with both an internal subset and a DTD, and you want
> to validate that document, do you have to call isValid() twice, once for the
> internal subset and once for the external DTD? Because if isValid() always

No, isValid() needs to be called only once, since the internal subset has a
pointer
to the external subset.

>
> validates against the internal subset as well as the active CM, how does
> that work out if the active CM represents an XML schema?

Why wouldn't it work out?  It would process the internal subset, e.g., entity
definitions, then go on to the active CM / external subset, which underneath
could be a DTD, XML Schema, database schema, etc.

>
>
> What happens when there are extra declarations in the internal subset which
> use declarations in the external DTD. E.g.
>   <?xml version="1.0"?>
>   <!DOCTYPE A SYSTEM "test.dtd"[
>     <!ATTLIST B
>         attName CDATA "bla">
>     <!ELEMENT D (B)>
>   ]>
>   <A>
>     <B/>
>   </A>
> where test.dtd holds
>   <!ELEMENT A (B)>
>   <!ELEMENT B ANY>
> Both the declarations of the attribute attName and the element D in the
> 'CM-tree' of the internal subset are related to the element declaration of
> B, which is defined in the (CM of the) external DTD. Is a copy of the
> element declaration of B made for the internal subset in this case?

Yes, the element declaration of B in the external subset would be used
for the internal subset, but I wouldn't call it a "copy".  It's as if you
defined
a macro in a header that you're including and then referenced the macro;
you don't really have 2 versions of that macro.

>
>
> (My questions come from some confusion from me about the spec: until today I
> thought that in case of a DTD the internal subset and external part would be
> one unified CM, until my attention was brought to getInternalCM())

The internal subset and external subset would comprise a unified CM.

Hope this helps,
Ben

>
>
> --Sander.
>
> --
> X-Hive Corporation (www.x-hive.com)
> email: sander@x-hive.com
> phone: +31 10 7108625

Received on Tuesday, 6 March 2001 18:16:49 UTC