Jim Dixon wrote:
On Mon, 11 Sep 2006, Ross Gardler wrote:


A better approach would be to process the XIncludes before validation,
stripping off the xlmns:xi attribute from the document element and
replacing xi:includes with whatever they resolve to.  This should be
cheaper than it might seem: unless the xmlns:xi is present, the
document is simply handed on to the validator untouched.

I can't see an easy way of doing this as, in many cases, the included
content is generated by Forrest. In fact, this would be a problem if the
parser were doing the includes.

I am baffled.  How would it be a problem if the parser was doing the
XIncludes?

David points out in another message that the validate-xdocs is done
prior to Forrest doing any transformations on content, it only validates
the *source* documents.


Yes.  Now think carefully about what you are saying.  Validation is
against the DTD, say document-v20.dtd.  This is validation of the source
document.  As it stands, if that source document has any xs:includes in
it, it is rejected by the validator.

Yes.

What you are saying is that when (some?) source documents are translated
into internal format, Forrest adds xi:includes, and the transformed
documents would not validate. That is, Forrest's internal format is not
compliant with document-v20.dtd.

Consider this XDoc snippet which could be a source document:

<body>
  <section>
    <title>foo</title>
    <p>blah blah blah</p>
    <xi:include src="bar/productList.xml"/>
  </section>
  ...
</body>

Now, consider that "bar/productList.xml" is generated by Forrest, through a query to a relational database.

If we simply "turn on" validation using the parser there xi:inlude would not exist since it is a dynamically created document. So that brings us to your proposal:

...

A cleaner solution, which involves little work, is to add an include
element to document-v20, which has the same attributes as xi:include.

-1

We are working towards an internal document format that is a subset of XHTML2. We have, for some time now, only been allowing changes to the XDoc DTD that conforms to XHTML2 because of this.

Also permit a xmlns:xi attribute on the document.

I take it you mean the namespace - in which case this should be fine.

 > Then turn on XInclusion in the parser.

Advise users that if they want to avoid validation of XIncluded XML
(because the XML doesn't exist yet, because it isn't static) they should
use the <include> element - which could only be used in certain places.

Since we can't have an include element this would be replaced by a message telling the user that if they are xi:inluding dynamic content they should turn off validation for those pages. Our existing validation exclusion code will work fine for this.

Ross