- From: Miles Sabin <msabin@cromwellmedia.co.uk>
- Date: Tue, 5 Jan 1999 10:04:38 -0000
- To: "'Lauren Wood'" <lauren@sqwest.bc.ca>, "'www-dom@w3.org'" <www-dom@w3.org>
Lauren Wood wrote, > The DOM Level 1 doesn't actually define how to create > (or save, for that matter) a document - it's something > that we're currently > discussing for Level 2. So what > should the Level 2 spec say on the matter? Err ... which matter? Document creation or auto-insert of HTML and BODY elements? On the latter, I think that HTMLDocument.getBody() should be defined to insert HTML and BODY elements if none currently exist, but that no other methods should do auto-insertion ... if an explict insert or append would create an invalid structure model an exception should be thrown. On the former, I can say what I'd like the Java version of a hypothetical API to look like. Something along the lines of the, by now almost cannonical, abstract factory + dynamic loading pattern that's used all over the place in Suns and others APIs, package org.w3c.dom; public interface DocumentFactory { public abstract Document createDocument(); } public abstract final class DocumentFactoryBuilder { public static DocumentFactory getInstance() { // try-catch omitted for brevity String docFactoryClassName = System.getProperty("org.w3c.dom.documentfactory"); return Class.forName(docFactoryClassName).newInstance(); } } package org.w3c.dom.html; public interface HTMLDocumentFactory { public abstract HTMLDocument createDocument(); } public abstract final class HTMLDocumentFactoryBuilder { public static HTMLDocumentFactory getInstance() { // try-catch omitted for brevity String docFactoryClassName = System.getProperty("org.w3c.dom.htmldocumentfactory"); return Class.forName(docFactoryClassName).newInstance(); } } I'm not sure how this should be mapped to IDL tho' ... the abstract class with an implemented method is essential to this technique. Some comments from a CORBA expert would be useful. Cheers, Miles -- Miles Sabin Cromwell Media Internet Systems Architect 5/6 Glenthorne Mews +44 (0)181 410 2230 London, W6 0LJ msabin@cromwellmedia.co.uk England
Received on Tuesday, 5 January 1999 05:08:56 UTC