I found some more information that might be helpful.

I tried using the TestXalanTransformer example and received the following
results.

The following snippet of code works.

    const char* const       theXMLFileName =
"file:///vol/users/kroy/testXalan/foo.xml";
//  const char* const       theXSLFileName =
"http://sundev4.workgroup.com:82/pctrxml/reports/XML.xsl";;
//  const char* const       theXSLFileName =
"http://w1000-10.workgroup.com/pctrxml/reports/XML.xsl";;
    const char* const       theXSLFileName =
"file:///vol/users/kroy/testXalan/XML.xsl";
    const char* const       theOutFileName =
"/vol/users/kroy/testXalan/foo.html";
 
    XalanTransformer xalan;
 
    const XalanCompiledStylesheet*  css = 0;
 
    if (xalan.compileStylesheet(theXSLFileName, css) != 0)
    {
        cout << xalan.getLastError();
 
        return 0;
    }
 
    for(int i=0; i<1; ++i)
    {
 
        if(xalan.transform(theXMLFileName, css,
"/vol/users/kroy/testXalan/foo.out"))
        {
            cout << xalan.getLastError();
 
            return 0;
        }
...

If I switch the theXSLFileNames, I receive the following error from the
transform statement.

Fatal Error at (file , line 0, column 0): An exception occurred! 
Type:MalformedURLException, 
Message:The URL used an unsupported protocol

Thanks,

Kevin

>  -----Original Message-----
> From:         Roy, Kevin  
> Sent: Monday, November 11, 2002 11:03 AM
> To:   '[EMAIL PROTECTED]'
> Subject:      Problem with running Xalan on Solaris 5.8 in C++.
> 
> Recently I took over a project that uses the xerces and xalan libraries.
> 
> The code that is causing the problem works beautifully on windows, but on
> sun we are receiving the 
> following error.
> 
> XSLT warning: Fatal Error at (file , line 0, column 0): An exception
> occurred! Type:MalformedURLException, Message:The URL used an unsupported
> protocol (, line -1, column -1)
> 
> I'm thinking this is a build problem, since this works on windows.  Since
> I'm new to xerces and xalan, it is a guess.
> 
> The following is the code to create the HTML page.
> 
> #ifdef XALAN_OLD_STREAMS
>     MSG_CODE GenerateHTML(ostream &strHTML)
> #else
>     MSG_CODE GenerateHTML(std::ostream &strHTML)
> #endif
>     {
>         MSG_CODE status = SUCCESS;
>         int transformResult = 0;
>         ResourceInfo *rsrc_info = sessionGetResourceInfo( m_pSession );
> 
>         // Call the static initializer for Xerces.
>         XMLPlatformUtils::Initialize();
> 
>         // Initialize Xalan.
>         XalanTransformer::initialize();
> 
>         // Create a XalanTransformer.
>         XalanTransformer theXalanTransformer;
> 
>         DOM_Document xmlDoc = DOM_Document::createDocument();
> 
>         status = GenerateXML(xmlDoc);
>         if (status != SUCCESS)
>             return status;
> 
>         XercesDOMSupport   theDOMSupport;
>         XercesParserLiaison theParserLiaison(theDOMSupport);
> 
>         if (m_strXSLServer == "") {
>             char *temp_path = resourceLookupName(rsrc_info,(char
> *)"site.admin.xslpath");
>             if (temp_path == NULL)
>                 m_strXSLServer = "http://localhost/PCXML/";;
>             else
>                 m_strXSLServer = temp_path;
>         }
> 
>         string xsl_fullPath = m_strXSLServer +
> PCTReportGetXSLName(m_pReport);
> 
>         if (m_strHTMLServer == "") {
>             char *temp_path = resourceLookupName(rsrc_info,(char
> *)"site.admin.htmlpath");
>             if (temp_path == NULL)
>                 m_strHTMLServer = "'http://localhost/'";
>             else {
>                 char tempString[4000];
>                 strcpy(tempString, "'");
>                 strcat(tempString, temp_path);
>                 strcat(tempString, "'");
>                 m_strHTMLServer = tempString;
>             }
>         }
>         // make sure the HTML server path is quoted
>         else if (strstr(m_strHTMLServer.c_str(),"'") == NULL) {
>             m_strHTMLServer = "'" + m_strHTMLServer + "'";
>         }
> 
>  
> theXalanTransformer.setStylesheetParam("PCTR_html_path",m_strHTMLServer.c_
> str());
> 
> 
>         XSLTInputSource xslDoc(xsl_fullPath.c_str());
> 
>         const XercesDOMWrapperParsedSource parsedSource(
>                                        xmlDoc,
>                                        theParserLiaison,
>                                        theDOMSupport,
>                                        XalanDOMString("test.xml"));
> 
>         transformResult =
> theXalanTransformer.transform(parsedSource,xslDoc,strHTML);
> 
>         // Terminate Xalan.
>         XalanTransformer::terminate();
> 
>         // Call the static terminator for Xerces.
>         XMLPlatformUtils::Terminate();
> 
>         if (transformResult != 0)
>         {
>             char sErr[2048];    //debuging
>             strcpy( sErr, "GenerateActionXMLFile Error: \n");
>             strcat( sErr, theXalanTransformer.getLastError());
> 
>             printf("%s\n", sErr );
> 
>             return (PCTR_REPORT_GENERALERR);
>         }
> 
>         return status;
>     }
> 
> The following is who I am building the app.
> 
> The object file compilation statement.
> 
> /opt/SUNWspro/bin/CC -mt -Dsun4 -I/pctr1/apl/include  -c -I../../itk
> -I../../PCXMLBlackBox -I../../../include -I. -I../../../../src/api
> -I../../../../../../../3pty/xerces-1.6.0/include
> -I../../../../../../../3pty/Xalan/include -DOS_UNIX -Dsun4 -g -o
> .obj/sun4_5/wtcReport.o wtcReport.cxx
> 
> Added to a library with
> 
> /opt/SUNWspro/bin/CC -mt -xar -o /pctr1/apl/lib/sun4_5/wtcapi.a
> .obj/sun4_5/wtcReport.o
> 
> And finally linked into the executible
> 
> /opt/SUNWspro/bin/CC -mt -lm -lc /usr/ucblib/libucb.a  -o .obj/sun4_5/test
> ..obj/sun4_5/testMain.o .obj/sun4_5/testReport.o
> /pctr1/apl/lib/sun4_5/wtcapi.a
> /3pty/xerces-1.6.0/lib/sun4/libxerces-c1_6_0.a
> /3pty/Xalan/sun4/libxalan-c1_3.a
> /3pty/xerces-1.6.0/lib/sun4/libxerces-c1_6_0.a
> /opt/SUNWspro/WS6U1/lib/libCrun.a /opt/SUNWspro/WS6U1/lib/libCstd.a
> -Bdynamic /usr/ccs/lib/libgen.a /usr/ccs/lib/liby.a /usr/ucblib/libucb.a
> -lsocket -lnsl -lintl -ldl -lm
> 
> Any help would be appreciated.
> 
> Kevin
> 
> 

Reply via email to