DOM oddity?
Martin von Loewis
loewis at informatik.hu-berlin.de
Sat Oct 27 15:32:18 EDT 2001
"Magnus Lie Hetland" <mlh at idi.ntnu.no> writes:
> From the xml.dom documentation[1]:
>
> prefix
> The part of the tagName preceding the colon if there is one, else
> the empty string. The value is a string, or None
>
> Under what circumstances can the prefix be None (as opposed to the empty
> string)?
If there is no namespace prefix, it is None. For example, if you do
createAttribute(), the DOM spec specifies that the result is
A new Attr object with the nodeName attribute set to name, and
localName, prefix, and namespaceURI set to null. The value of the
attribute is the empty string.
In Python, a null string maps to None; since the empty string maps to
the empty string.
HTH,
Martin
More information about the Python-list
mailing list