This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients eli.bendersky, rhettinger, scoder
Date 2015-05-26.00:54:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432601650.19.0.16515305979.issue24287@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, ElementTree doesn't support comments and processing instructions in the prolog.  That is the typical place to put style-sheets and document type definitions.

It would be used like this:

    from xml.etree.ElementTree import ElementTree, Element, Comment, ProcessingInstruction

    r = Element('current_observation', version='1.0')
    r.text = 'Nothing to see here.  Move along.'
    t = ElementTree(r)
    t.append(ProcessingInstruction('xml-stylesheet', 'href="latest_ob.xsl" type="text/xsl"'))
    t.append(Comment('Published at: http://w1.weather.gov/xml/current_obs/KSJC.xml'))

That creates output like this:

    <?xml version='1.0' encoding='utf-8'?>
    <?xml-stylesheet href="latest_ob.xsl" type="text/xsl"?>
    <!--Published at: http://w1.weather.gov/xml/current_obs/KSJC.xml-->
    <current_observation version="1.0">
    Nothing to see here.  Move along.
    </current_observation>
History
Date User Action Args
2015-05-26 00:54:10rhettingersetrecipients: + rhettinger, scoder, eli.bendersky
2015-05-26 00:54:10rhettingersetmessageid: <1432601650.19.0.16515305979.issue24287@psf.upfronthosting.co.za>
2015-05-26 00:54:09rhettingerlinkissue24287 messages
2015-05-26 00:54:09rhettingercreate