ANSWER: [ZPT] Preserve case in XML elements outside Zope
Wade Leftwich
wade@okaynetwork.com
Fri, 23 Nov 2001 16:09:01 -0500
After a bit of study, I did find a simple answer to my own question,
which I'll share here in case anyone else has been puzzled by this.
A PageTemplate object has a 'content_type' attribute, which defaults
to 'text/html'. The _cook() method checks it to decide which parser
to use.
If you set the content_type to anything other than 'text/html' before
using the write() method, case will be preserved.
>>> pt = PageTemplate()
>>> pt.content_type
'text/html'
>>> pt.write('<FOO/>')
>>> pt()
'<foo />\n'
>>> pt.content_type = 'fred'
>>> pt.write('<BAR/>')
>>> pt()
'<BAR/>\n'
>>>
Notice that the html parser also adds a space in front of the
closing slash on an empty element.
-- Wade Leftwich
Ithaca, NY
11/23/2001 1:36:46 PM, seb bacon <seb@jamkit.com> wrote:
>* Chris Withers <chrisw@nipltd.com> [011123 17:33]:
>> Wade Leftwich wrote:
>> >
>> > Is there a switch I can throw somewhere to preserve the case of
>> > the identifiers?
>>
>> I would have thought that in xml, you shouldn't be relying on the
>> capitalisation of identifiers...
>
>fyi, xml is case-sensitive, and xhtml *must* be lower case. nothing
>else useful to add though ;-)
>
>seb
>
>