Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2010
    Posts
    1

    Unanswered: Internal Functions using libxml and xml.h

    Hi! I'm trying to create an internal function using libxml2 library and xml.h (the one in the postgresql source), so far I've accomplished nothing, I have no problem compiling the c source code, and no problem either registering the function in the database, it's its execution what's not working, so, I tried just using one of the functions withing the xml.c file, specifically I used xml_in which is defined as follows

    Datum xml_in(PG_FUNCTION_ARS){
    char * s = PG_GETARG_CSTRING(0);
    xmltype * vardata;
    xmlDocPtr doc;

    vardata = (xmltype *) cstring_to_text(s);
    doc = xml_parse(vardata,xmloption,true,GetDatabaseEncodi ng());
    xmlFreeDoc(doc),

    PG_RETURN_XML_P(vardata);
    }

    well, this compiles and everything but when I try the sentence

    SELECT xml_in('<root><node>1</node></root>');

    the output is "Undefined symbol: xml_parse", I'm thinking maybe I need to link something or tell something else to the postgres server, anyway, I'll really appreciate if anyone can gimme a hand on this one, I'm stuck and getting frustrated and really need to get this done to advance on my thesis project, thank you very much!

  2. #2
    Join Date
    Oct 2010
    Posts
    4
    Quote Originally Posted by nrgb View Post
    Hi! I'm trying to create an internal function using libxml2 library and xml.h (the one in the postgresql source), so far I've accomplished nothing, I have no problem compiling the c source code, and no problem either registering the function in the database, it's its execution what's not working, so, I tried just using one of the functions withing the xml.c file, specifically I used xml_in which is defined as follows

    Datum xml_in(PG_FUNCTION_ARS){
    char * s = PG_GETARG_CSTRING(0);
    xmltype * vardata;
    xmlDocPtr doc;

    vardata = (xmltype *) cstring_to_text(s);
    doc = xml_parse(vardata,xmloption,true,GetDatabaseEncodi ng());
    xmlFreeDoc(doc),

    PG_RETURN_XML_P(vardata);
    }

    well, this compiles and everything but when I try the sentence

    SELECT xml_in('<root><node>1</node></root>');

    the output is "Undefined symbol: xml_parse", I'm thinking maybe I need to link something or tell something else to the postgres server, anyway, I'll really appreciate if anyone can gimme a hand on this one, I'm stuck and getting frustrated and really need to get this done to advance on my thesis project, thank you very much!
    Look like it doesn't have the function xml_parse,
    I think you may not install it correctly.

    Could you share to anybody how are you complie the library ? and if it is not the license could you share me the code of your files?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •