[XML-SIG] Python DOM Unification -- level

Mike Olson mike.olson@fourthought.com
Tue, 27 Apr 1999 11:59:49 -0500


This is a cryptographically signed message in MIME format.

--------------ms95352A88316FA873F0E7C460
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit



"Fred L. Drake" wrote:

> Mike Olson writes:
>  > Node, no, but NodeList and NamedNodeMap are just containers and I see no
>  > reason why a client should not be able to create them.
>  >
>  > Maybe they are doing some post processing ontop of the DOM but want to
>  > keep a DOMish interface.  Then they will need to create NodeLists and
>  > NamedNodeMaps to repackage nodes.
>
> Mike,
>   Do you think this would be doable in a way portable across DOM
> implementations?  I've not looked at 4DOM (even though I intended to
> ;), so I don't know how much it differs from PyDOM under the hood.  I
> would expect that if building these is important, factory methods
> should be created on the Document object in the same way that there
> are factory methods for elements, etc.
>   It's not that I object to having the classes available, it's that I
> don't see any requirement that they be available or that different DOM
> implementations share the implementation, even as a base class.
>   I'm not convinced of Andrew's claim that having Node available for
> type tests would be useful, either.  ;-)  That would also make it
> difficult to create an all-C implementation of the DOM.  (No, I don't
> have one in the works.)
>

We didn't want to pollute the Document API with all of these extra factory
methods.  We moved all of the stuff that you cannot build from a document into
out Factory interface.  we also put in all of the other node types so there is
one common factory for Nodes.  In 4DOM a document has an internal member
"factory" where it really creates all of its stuff.  This allows us to have a
"remote" factory if needed.

Note we added the idea of an HTMLDocument.  An HTMLDocument is a Document, but
added functionality to meet a bunch of the DOM imposed requirements. ie a
document must always have a head and body.  It also overrides the creatElement
to create DOM HTML classes of the required tag.

I don't think anything is gained exposing Node.  I see Andrew's pooint that at
the Node level, appendChild must check to make sure that only Nodes are being
added.  But down the hierarchy chain another check must be made, this is to
make sure that:

a) only one Element is added to a document
b) no text is added to a document
c) etc

so there is already validation that the object derives from Node.

I think the factory methods would have to be DOM implementation specific.  We
might be able to have one factory that creates Python DOM implementation
NodeList etc but I don't see much gained.

I don't think that all python implementations should share base classes and
NodeLists, et al.  Each should have thier own implementation tailored to its
purpose, ie speed, orbed, lightweight


NodeFactory.idl
#pragma prefix "fourthought.com"

#include "../../DOM.idl"
#include "../../HTML/HTML.idl"

module NodeFactoryIF {

        typedef sequence<DOMIF::Node> listofnodes;

        interface NodeFactory {

                //The user should only call these four methods
                HTMLIF::HTMLDocument createHTMLDocument();
                DOMIF::Document createDocument();
                HTMLIF::HTMLElement createHTMLElement(in HTMLIF::HTMLDocument
parent,in string tag);
                void releaseNode(in DOMIF::Node node);

                //Non public interface: user shouldn't call these
                //All require the ownerDocument, but when called from
                //Document.py, this is provided for the user
                DOMIF::DOMImplementation createDOMImplementation(in string
feature, in string version);
                DOMIF::NodeList createNodeList(in listofnodes nodes);
                DOMIF::NamedNodeMap createNamedNodeMap();
                DOMIF::Element createElement(in  DOMIF::Document ownerDocument,
in string tagName);
                DOMIF::DocumentFragment createDocumentFragment(in
DOMIF::Document ownerDocument);
                DOMIF::DocumentType createDocumentType(in DOMIF::Document
ownerDocument, in string name, in
DOMIF::NamedNodeMap entities, in DOMIF::NamedNodeMap notations);
                DOMIF::Text createTextNode(in DOMIF::Document ownerDocument, in
string data);
                DOMIF::Comment createComment(in DOMIF::Document ownerDocument,
in string data);
                DOMIF::CDATASection createCDATASection(in DOMIF::Document
ownerDocument, in string data);
                DOMIF::ProcessingInstruction createProcessingInstruction(in
DOMIF::Document ownerDocument, in string
target, in string data);
                DOMIF::Attr createAttribute(in DOMIF::Document ownerDocument,
in string name);
                DOMIF::Entity createEntity(in DOMIF::Document ownerDocument, in
string publicId, in string systemId, in
string notationName);
                DOMIF::EntityReference createEntityReference(in DOMIF::Document
ownerDocument,in string name);
                DOMIF::Notation createNotation(in DOMIF::Document
ownerDocument, in string publicId, in string systemId,
in string name);
                DOMIF::NodeIterator createNodeIterator(in DOMIF::Node
start_node);
                DOMIF::NodeIterator createSelectiveNodeIterator(in DOMIF::Node
start_node, in unsigned short
what_to_show);
                DOMIF::NodeIterator createFilteredNodeIterator(in DOMIF::Node
start_node, in DOMIF::NodeFilter filter);
                DOMIF::NodeIterator createSelectiveFilteredNodeIterator(in
DOMIF::Node start_node, in unsigned short
what_to_show, in DOMIF::NodeFilter filter);
                HTMLIF::HTMLCollection createHTMLCollection(in listofnodes
nodes);
        };
};

Mike

>
>   -Fred
>
> --
> Fred L. Drake, Jr.           <fdrake@acm.org>
> Corporation for National Research Initiatives

--
Mike Olson
Member Consultant
FourThought LLC
http://www.fourthought.com http://opentechnology.org


---

"No program is interesting in itself to a programmer. It's only interesting as
long
as there are new challenges and new ideas coming up." --- Linus Torvalds


--------------ms95352A88316FA873F0E7C460
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIIKmQYJKoZIhvcNAQcCoIIKijCCCoYCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC
CCUwggTvMIIEWKADAgECAhAOCY8cYeSQOObs5zKyDmWRMA0GCSqGSIb3DQEBBAUAMIHMMRcw
FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29y
azFGMEQGA1UECxM9d3d3LnZlcmlzaWduLmNvbS9yZXBvc2l0b3J5L1JQQSBJbmNvcnAuIEJ5
IFJlZi4sTElBQi5MVEQoYyk5ODFIMEYGA1UEAxM/VmVyaVNpZ24gQ2xhc3MgMSBDQSBJbmRp
dmlkdWFsIFN1YnNjcmliZXItUGVyc29uYSBOb3QgVmFsaWRhdGVkMB4XDTk5MDMwNTAwMDAw
MFoXDTk5MDUwNDIzNTk1OVowggEKMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UE
CxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazFGMEQGA1UECxM9d3d3LnZlcmlzaWduLmNvbS9y
ZXBvc2l0b3J5L1JQQSBJbmNvcnAuIGJ5IFJlZi4sTElBQi5MVEQoYyk5ODEeMBwGA1UECxMV
UGVyc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