Re: [xml] Catalogs, python bindings, rewriteURI, & segfault



On Tue, Dec 02, 2003 at 10:37:29AM -0800, John L. Clark wrote:
[user host ~]$ python
Python 2.3.2 (#1, Nov 21 2003, 14:36:46)
[GCC 3.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import libxml2
cat = libxml2.catalog('catalog')
result = cat.resolveURI('http://some.web.site/page')
Segmentation fault
[user host ~]$

  That segfaults here too.

 
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1074143904 (LWP 16638)]
xmlACatalogResolveURI (catal=0x7, URI=0x81f6d94 "http://some.web.site/page";)
    at catalog.c:2711
2711        if (catal->type == XML_XML_CATALOG_TYPE) {
(gdb) up
#1  0x402fdb6f in libxml_xmlACatalogResolveURI (self=0x0, args=0x81e529c)
    at libxml2-py.c:7958
7958        c_retval = xmlACatalogResolveURI(catal, URI);
(gdb) where
#0  xmlACatalogResolveURI (catal=0x7,
    URI=0x81f6d94 "http://some.web.site/page";) at catalog.c:2711
#1  0x402fdb6f in libxml_xmlACatalogResolveURI (self=0x0, args=0x81e529c)
    at libxml2-py.c:7958

  the way you try to get an handle to a catalog is wrong.
If python had static type I could raise a problem but currently I
don't know. 
  use 
  def loadACatalog(filename):
    """Load the catalog and build the associated data structures.
       This can be either an XML Catalog or an SGML Catalog It
       will recurse in SGML CATALOG entries. On the other hand
       XML Catalogs are not handled recursively. """

import libxml2
cat = libxml2.loadACatalog('catalog')
result = cat.resolveURI('http://some.web.site/page')
print result
file:///some/directory/page


Daniel

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]