4DOM Standards-Based XML and HTML manipulation using Python Fourthought, Inc. http://4Suite.org 2000-11-01 4Suite 0.9.2 released. 2000-10-11 4Suite 0.9.1 released. 2000-09-20 4Suite 0.9.0 released. 4DOM is now bundled therein 2000-07-24 4DOM 0.10.2 released 2000-06-06 4DOM 0.10.1 released 2000-05-24 4DOM 0.10.0 released 2000-03-16 4DOM 0.9.3 released 2000-01-25 4DOM 0.9.2 released 2000-01-03 4DOM 0.9.1 released 1999-12-19 4DOM 0.9.0 released 1999-10-21 4DOM 0.8.2 released 1999-09-14 4DOM 0.8.1 released 1999-08-31 4DOM 0.8.0 released 1999-02-07 4DOM 0.7.0 released 1998-11-20 4DOM 0.6.1 released 1998-11-04 4DOM 0.6.0 released 4DOM is a Python implementation of the document object model (DOM), a standard interface for manipulating XML and HTML documents developed by the World-Wide Web Consortium. 4DOM implements DOM Level 2 Core, Level 2 HTML and Document Traversal, and a few extensions. 4DOM is designed to allow developers rapidly design applications that read, write or manipulate HTML and XML. The current version is bundled with 4Suite . See the ChangeLog for notes on the current version. Download 4Suite install one of the binary packages. Alternatively, you can download the source instead and install using Python distutils as follows: python setup.py install See PACKAGES for more information about the available 4Suite packages. Be sure to check the README in the 4Suite package for more details. xml/dom Core DOM components (including XML classes) xml/dom/html HTML components xml/dom/ext Extensions and proprietary components xml/dom/docs (currently minimal) documentation DOCUMENTATION_PATH/4Suite/4DOM/demo Small scripts demonstrating some uses of 4DOM. See the README in this directory. DOCUMENTATION_PATH/4Suite/4DOM/test_suite Test scripts. Accessors/Mutators for Attributes Following discussion on the Python XML SIG mailing list, 4DOM provides two ways to access DOM interface attributes. As an example, the DOM IDL definition for the Node interface contains readonly attribute DOMString childNodes. This can be accessed as a simple Python attribute: node.childNodes, or as a method call using the Python/CORBA mapping for attributes: node._get_childNodes() [if childNodes were a read/write attribute, there would also be a node._set_childNodes()]. There is a slight speed advantage to using the latter convention. Document._get_ownerDocument() Document._get_ownerDocument() returns a pointer to itself. Creating HTML Element Nodes HTMLDocument.createElement() overrides the Document.CreateElement() method, looking up the specified tag and returning an instance of the propriate HTML node. For instance: # html_doc is an instance of HTMLDocument table_elem = html_doc.createElement("TABLE") # table_elem is an instance of HTMLTableElement 4DOM does not implement DOMString. Instead, the interfaces use a plain Python string instead. Note that Python strings do not have length limitations, and unicode is still in beta. The DOM Spec section on the removeAttribute method of the Element interface has some rules for Attribute removal with respect to default values. 4DOM only follows these rules if you remove attributes using the removeAttribute method, and the default attribute will not be properly set if you use removeNamedItem to remove an attribute from the NamedNodeMap returned by Element.getAttributes. The DOM ambiguously specifies that if the given name in the removeNamedItem method of NamedNodeMap not found, None is returned and an exception is raised. This isn't possible in most languages. 4DOM chooses to return None. 4DOM does not implement HTMLElement features strictly for browser environment, for example, blur and focus properties of HTMLSelectElement. Some methods of the DOM spec for HTML do not allow for errors associated with missing nodes. So, for example, HTMLDocument::setTitle() does not allow for the return of an error if the HTMLDocument does not have an HTMLHeadElement child. 4DOM, in these cases, will automatically add in needed elements in order to strictly follow the DOM interface spec. The methods for which 4DOM provides automatic document completion are: HTMLDocument::getDocumentElement() HTMLDocument::setTitle() HTMLDocument::getBody() HTMLDocument::setBody() HTMLTableElement::insertRow() HTMLTableRowElement::insertCell() See 4DOM Extensions for documentation of proprietary extensions and helper functions provided by 4DOM. For release notes and news, see http://4Suite.org The 4Suite users and support mailing list can be subscribed to, and archives viewed at http://lists.fourthought.com/mailman/listinfo/4suite 4Suite developers monitor the above list, and prefer for support to come thereby, but you can also contact them directly at support@4suite.org with questions and comments. You might also post messages to or check the archives of the Python xml-sig mailing list.