[Rpm-metadata] updates

Daniel Veillard veillard at redhat.com
Fri Oct 24 15:40:54 UTC 2003


On Thu, Oct 23, 2003 at 12:13:39PM -0400, Joe Shaw wrote:
> On Thu, 2003-10-23 at 03:02, seth vidal wrote:
> > 2. produced a sample of the format indexing all of fedora-core-test2 
> > (this is a big 4.0M file - becareful if you're on a slow connection)
> >  http://linux.duke.edu/~skvidal/metadata/fedora-core-test2-metadata.xml
> 
> This file isn't valid UTF-8. :)  Looks like a couple package
> descriptions or summaries are encoded in a non-specified encoding. :)

  Hum, seems that libxml2 error message got inserted at the beginning
of the XML result:

paphio:~/XML -> more ../fedora-core-test2-metadata.xml
xmlEncodeEntitiesReentrant : input not UTF-8
<?xml version="1.0"?>
<metadata xmlns="http://linux.duke.edu/md/common">
  <package type="rpm">
    <name>4Suite</name>
....

This makes the file not XML actually, no XML parser should produce
any result when parsing it.
The bug is probably related to an error in the python bindings of 
libxml2 printing to stdout instead of stderr (that was fixed last month).
The simplest is to catch the libxml2 errors with
-------------
err=""
def callback(ctx, str):
     global err
                                                                                
     err = err + "%s %s" % (ctx, str)
                                                                                
libxml2.registerErrorHandler(callback, "-->")
-------------

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



More information about the Rpm-metadata mailing list