You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Rigo <r....@travelselect.com> on 2001/07/03 11:38:51 UTC

Cannot get it to work!

Hello!

At the company I work for, we use CGI's (programmed in C) and basically
every CGI produces as an outcome a HTML, now we want to move forward and
start generating XML instead then parse it and then generate the HTML to
send to the browser. Thats why we are trying XALAN to see if thats the right
move for us.

I have been trying a very simple example using the C API interface that you
provide with XALANTRANSFORMERCAPI.H but have not been lucky to get it to
work. Could you please tell me what I am doing wrong or if I am missing some
important and decisive feature or something or  that I am just misusing
it?!?

Let me describe my example/code so you get a better idea of the whole
scenario.

In principle, the core of the CGI will generate an XML which is written to a
string (or a file and for the sake of the example I have used the foo.xml
and the foo.xsl sample that you provide) then pass it to the
XalanTransformToData and get the result back on a stream pointer (the char**
argument of it).

  char** ptrString;
  XalanHandle *xalan = NULL;
  int resultCode = 0;

     // Initialise the XALAN and create the TRANSFORMER

    XalanInitialize();
    xalan = CreateXalanTransformer();

      // Parsing and then analysing the XML file using the XSL file as well.

    resultCode = XalanTransformToData("foo.xml","foo.xsl",&ptrString,xalan);

     // Handling the outcome

    if(!resultCode)  {
      printf("%s<br>\n", *ptrString);
    }
    else printf("The parsing was unsuccessful.\n");

      // clean memory and close down Xalan.

    XalanFreeData(*ptrString);
    DeleteXalanTransformer(xalan);
    XalanTerminate();

Even when trying with foo.xml and foo.xsl no good result is obtained, I get
a -1 value from  resultCode. what does it mean? (have searched the whole
site for error codes to no avail).

Have previously tried allocating memory for ptrstring and passing it to the
function without using & but then an internal server error was the result.
Do i need to allocate memory for it or u do it within the function
XalanTransformToData?? &ptrString is the right usage??

I hope you can help me out or point me in the right direction as to where I
can find out about all this.

Thanks a lot for your time,

Rigo.


==============================================================================
This message has been checked for all known viruses by MessageLabs. 
This message is intended for the stated recipients only and may be confidential. Opinions expressed in this email do not necessarily reflect the opinions of GlobePost Travel or Travelselect.com. If you are not the intended recipient of this message, please notify the sender immediately.  ==============================================================================