Changeset 2618:55bea42bc1b2 in livinglogic.python.xist for src/ll/xist/scripts/dtd2xsc.py

Show
Ignore:
Timestamp:
01/30/07 18:14:11 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Start implementation of XIST 3.0:

Namespace classes are gone now. Instead of them, an element class must define
an xmlns class attribute with the namespace name (it's no longer possible
to assign an element to a namespace after the class has been created).
Processing instructions, entities and charrefs no longer have any connection
to namespaces whatsoever.

For parsing Registry objects are used now, they store the element classes
keyed by Python/XML name and namespace name. There's a defaultregistry where
all classes will be registered (this can be changed by using an alternative
registry in a with block). xsc.NSPool, xsc.Prefixes and the global registry
of namespaces no longer exists (but there's now a global registry of
element classes, pi classes, entity classes, charref classes and attribute
class).

The goal is to be able to use elements without having to define classes for
them. For this the registry would create an Element object directly and set
xmlns on the instance (instead of the element class). The publisher then would
have to use the xmlns on the instance too. xfind has to be extended to support
those classes.

Namespace handling in publishing has finally been fixed. XIST will no longer
use the empty prefix for global attributes or one prefix for two namespace.
Handling the XML namespace (i.e. for xml:lang and xml:space) has been
hardcoded, there's no longer an overwritable xmlprefix() method.

In many spots (e.g. Attrs.iterkeys() etc.) the order of namespace name and
element name has been reversed.

Handling the name of nested classes has been simplyfied. There's no longer and
outerclass attribute (which resulted in cycles), but the fullname will
be set directly.

Virtual dispatching for elements will be implemented later.

Fixed a bug in parser.parseURL() (finalurl must be called!)

A bunch of deprecated methods (all related to attributes) have been removed from
Element.

ll.xist.ns.detox now only has one end pi (if it's used without content the
last block will be closed, if a content is specified (i.e. <?end loop?> it
will check that the innermost block is of the correct type).

The code requires Python 2.5 now (because of with blocks and if-else expressions)

Updated copyright year.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/scripts/dtd2xsc.py

    r2590 r2618  
    22# -*- coding: iso-8859-1 -*- 
    33 
    4 ## Copyright 1999-2006 by LivingLogic AG, Bayreuth/Germany. 
    5 ## Copyright 1999-2006 by Walter Dörwald 
     4## Copyright 1999-2007 by LivingLogic AG, Bayreuth/Germany. 
     5## Copyright 1999-2007 by Walter Dörwald 
    66## 
    77## All Rights Reserved 
     
    3131 
    3232 
    33 def dtd2xsc(dtdurl, outurl, verbose, xmlname, xmlurl, shareattrs, asmod, defaults): 
     33def dtd2xsc(dtdurl, outurl, verbose, xmlname, xmlurl, shareattrs, model, defaults): 
    3434    if verbose: 
    3535        print "Parsing DTD %s ..." % dtdurl 
     
    4848        print "Writing to %s ..." % outurl 
    4949    file = outurl.openwrite() 
    50     file.write(data.aspy(asmod=asmod, defaults=defaults)) 
     50    file.write(data.aspy(model=model, defaults=defaults)) 
    5151    file.close() 
    5252