[XML-SIG] Re: sgmllib has problems with dots in tag names (XML-SIG digest, Vol 1 #334)

N.A.F.M. Poppelier nico@salience.nl
Mon, 19 Jul 1999 10:17:54 +0200


This is a multi-part message in MIME format.
--------------F4638FB6F8782776CFD7230F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

xml-sig-admin@python.org wrote:
> That's a solution that works with the standard sgmllib from the Python
> distribution. However this solution does not work with sgmllib from
> xml.parsers. I'm not sure if tag names with dots in their names are valid in XML
> or not. 

> If you want callbacks named after element types, then there is no way
> out other than to do some name mangling. There are lots of characters
> valid in SGML/XML element type names that are not legal in function/method
> names. Characters like "-" and "." are popular ones:-)

As anyone with a Web browser can verify, version 1.0 of the XML standard
defines
a name (appearing in a start tag or end tag, for example) as "a token
beginning with a letter or one of a few punctuation characters, and
continuing
with letters, digits, hyphens, underscores, colons, or full stops,
[...]".

It is natural to use the element name or tag name as the default name
to generate a function or method name. But in cases where the name space 
of the programming language used is not identical to the name space of 
XML, some escape mechanism must be in place. One possibility is to 
allow the user to specify a map from XML name to function/method name, 
and use the value from this map, if it exists, and otherwise use the 
default based on the XML name.

Nico
--------------F4638FB6F8782776CFD7230F
Content-Type: text/x-vcard; charset=us-ascii;
 name="nico.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for N.A.F.M. Poppelier
Content-Disposition: attachment;
 filename="nico.vcf"

begin:vcard 
n:Poppelier;Nico
tel;pager:-
tel;cell:06-20412666
tel;fax:-
tel;home:-
tel;work:030-6056675
x-mozilla-html:FALSE
url:http://www.salience.nl
org:Salience
adr:;;Villawal 21;Nieuwegein;;;The Netherlands
version:2.1
email;internet:nico@salience.nl
title:project manager SGML/XML
note;quoted-printable:''The new pond=0D=0AA frog jumps in=0D=0ADeadly silence''
fn:Nico Poppelier
end:vcard

--------------F4638FB6F8782776CFD7230F--