[XML-SIG] Marshalling

Paul Prescod paul@prescod.net
Fri, 18 Dec 1998 09:04:55 -0600


"Andrew M. Kuchling" wrote:
> 
>         My fuzzy argument for this was that I wanted the user to write
> only a single subclass, not two of them.

Consider having some kind of DTD-adapter class. Python is sufficiently
flexible that sometimes delegation and adapters are simpler than
subclassing.

>         Probably data_stack shouldn't be an attribute of the class,
> but be passed to each of the unmarshalling functions.  That would mean
> that the Marshaller class would have no mutable attributes at all, and
> the self.__class__ thing would be unnecessary.

Good idea.

> > * Maybe string handling should be safer...i.e. control characters
> 
>         Shouldn't control characters, such as chr(9) or chr(7) be
> fine?  The code already escapes <,&,>, and aren't those the only
> characters to worry about?

chr(9), yes. chr(7) no.

From REC-XML:

Char ::=  #x9 | #xA | #xD | [#x20-#D7FF] | [#xE000-#xFFFD]
              | [#x10000-#x10FFFF]

>  <sigh> Definitely, if it supports generic Python instances.  However,
> I'm less interested in reproducing pickle in XML than in providing a
> base for supporting all the various DTDs that are popping up.

Presumably the number of new DTDs is going to slow down. That territory on
the noosphere is getting crowded.

To me, transporting instances is the difference between being useful and
being mildly convenient. Allaire has agreed to support my "type"
attribute, which strikes me as the major thing required to make this stuff
useful for Python->Python object transmission.

Also, I think it would be a good idea for Python's ASCII pickle format to
(eventually!) be standards-based (i.e. WDDX or something). Sure, it would
result in a blow-up, but ASCII pickle is already vebose and slow. Given
the choice between proprietary, verbose and slow or open, really verbose
and very slow, I think that the latter would be better. If ASCII pickle is
intended for human readability and debugging, then why not make it more
readable and even editable in XML editors?

The whole basis for WDDX and XML-RPC is that XML is bloody verbose but it
is also very human-friendly.

Anyhow, I'm not trying to invent work for you. If there is some easy way I
can add instance marshalling support to only the WDDX subclass (or
"adapter") then I will do that. We can migrate it towards full pickle
functionality when and if it  becomes popular enough to justify the work.

 Paul Prescod  - ISOGEN Consulting Engineer speaking for only himself
 http://itrc.uwaterloo.ca/~papresco

"Sports utility vehicles are gated communities on wheels" - Anon