DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14084>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14084

Problem with XalanTransformer::transform()

           Summary: Problem with XalanTransformer::transform()
           Product: XalanC
           Version: 1.4.x
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: XalanC
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


This is the routine I am trying to port to the stable versions of Xerces 2.1.0 
& Xalan 1.4:

int doXSLT( const char *xslFileName, const DOMDocument *XMLDoc, char 
**pResultHTML )
{
int theResult = 0;

   if ( XMLDoc->getFirstChild() == NULL )
      return -1;

   XercesParserLiaison liaison;
   XercesDOMSupport    support;
   XercesDOMWrapperParsedSource xmlSource( (const DOM_Document &) *XMLDoc, 
liaison, support );

   strstreambuf my_streambuf;
   ostream mi_strout( &my_streambuf );
   const XSLTResultTarget outputTarget( &my_strout );

   XalanTransformer theXalanTransformer;

   XSLTInputSource stylesheetSource( xslFileName );

   theResult = theXalanTransformer.transform( xmlSource, stylesheetSource, 
outputTarget );

   if ( theResult != 0 )
      {
      fprintf( stderr, "XML/XSL: %s\n", theXalanTransformer.getLastError() );
      theResult = -99;
      }
   else
      {
      char *presult = my_streambuf.str();
      unsigned int len = my_strout.tellp();
      *pResultHTML = (char *) malloc( len + 1 );
      if ( *pResultHTML == NULL )
         {
         theResult = -1;
         }
      else
         {
         memcpy( *pResultHTML, presult, len );
         (*pResultHTML)[ len ] = 0x00;
         }
      delete [] presult;
      }

   if ( theResult != 0 && *pResultHTML != NULL )
      {
      free( *pResultHTML );
      *pResultHTML = NULL;
      }

   return theResult;
}
 
The sentence XercesDOMWrapperParsedSource produces a segment violation. I don't 
know if this is the correct way to do this. I can't find on all XalanC 
interface anything about the new Xerces class DOMDocument. I suppose that my 
problem is the casting from class DOMDocument to class DOM_Document.
I think that the Xalan interface should give me simpler way to do the XSLT 
transformation from a DOMDocument object.

Do you have any suggestions for me?

Thanks and best regards.

Reply via email to