Re: new pkg metadata generating scripts

Daniel Veillard <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
On Mon, Nov 24, 2003 at 08:43:50AM -0500, seth vidal wrote:
> >   Hum, gzip support is included directly, do
> >     doc.setDocCompressMode(9)
> >     doc.saveFile(filename)
> > that should work.
> 
> couple of small problems:
> 1. how do I specify an encoding or pretty-printing of the xml

libxml2.py around line 2970

    def saveFile(self, filename):
        """Dump an XML document to a file. Will use compression if
           compiled in and enabled. If @filename is "-" the stdout
           file is used. """
        ret = libxml2mod.xmlSaveFile(filename, self._o)
        return ret
                                                                                
    def saveFileEnc(self, filename, encoding):
        """Dump an XML document, converting it to the given encoding """
        ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
        return ret

    def saveFormatFile(self, filename, format):
        """Dump an XML document to a file. Will use compression if
           compiled in and enabled. If @filename is "-" the stdout
           file is used. If @format is set then the document will be
           indented on output. Note that @format = 1 provide node
           indenting only if xmlIndentTreeOutput = 1 or
           xmlKeepBlanksDefault(0) was called """
        ret = libxml2mod.xmlSaveFormatFile(filename, self._o, format)
        return ret
                                                                                
    def saveFormatFileEnc(self, filename, encoding, format):
        """Dump an XML document to a file or an URL. """
        ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
        return ret


> 2. any plans on adding bzip2 support now that module is included in
> python 2.3?

  The support has to be handled at the C library level. the python
bindings are just a think layer on top of it. Adding at the C library
level is vastly more complex, especially since it require a new or
a change in the API.

> >   Maybe gzipOpen() returned object are not detected as file object
> > by libxml2 python wrappers. Extract a small example and post it to
> > [email protected] or onto gnome bugzilla so I will have a look,
> 
> I will, thanks.

  Okay,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
[email protected]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.