Stream contains the XML-content. But the segmentation fault seems to be
caused
when the error handler tries to access null pointer (probably filename).

Best,
Victor S. Popov

-----Original Message-----
From: Charles Nicholson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 8:47 PM
To: '[EMAIL PROTECTED]'
Subject: RE: XalanC++ (Segmentation Fault)

Does your stream hold the filename itself or the XML content?  If you're
using a stream, it should hold the contents of your XML files.  Otherwise,
just use something like:
XSLTInputSource xmlIn("foo.xml");
XSLTInputSource xslIn("foo.xsl");
XSLTResultTarget xmlOut("foo-out.xml");
Regards,
-Charles
-----Original Message-----
From: Victor S. Popov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 1:00 PM
To: Charles Nicholson
Subject: RE: XalanC++ (Segmentation Fault)


Yes. We tried them both. Same pattern (core dumped) with stringstreams.
Thanks,
Victor.
-----Original Message-----
From: Charles Nicholson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 8:29 PM
To: '[EMAIL PROTECTED]'
Subject: RE: XalanC++ (Segmentation Fault)


have you tried 'stringstream'?  It's in <sstream>.  We had all sorts of
memory leaks and crashes using strstreams that went away when we migrated to
stringstreams.
HTH
-chas
-----Original Message-----
From: Victor S. Popov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 22, 2002 11:54 AM
To: [email protected]
Subject: XalanC++ (Segmentation Fault)


Hi!
We are trying to use XalanC++ to transform XML to HTML. I've tried to use
string streams as input sources and got "Segmentation Fault" in case of
invalid XSL-source by the means of structure, i.e. no exception was thrown.
Nevertheless when I use files with the same sources (invalid XSL) instead of
streams, it works - transformer treats the error normally. Here is the code
of prototype:
XML:
<?xml version="1.0"?>
<document attribute="Test"/>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:value-of select="."/> <!-- structural trap -->
        <xsl:template match="/">
                <html><body>Test</body></html>
        </xsl:template>
</xsl:stylesheet>
CODE:
{
        istrstream xml_stream (xml_text, strlen (xml_text));
        istrstream xsl_stream (xsl_text, strlen (xsl_text));
        XalanTransformer xalan;
        XSLTInputSource xml (& xml_stream /* "xml.xml" */);
        XSLTInputSource xsl (& xsl_stream /* "xsl.xsl" */);
        XSLTResultTarget output (cout);
        try {
                if (xalan.transform(xml, xsl, output) != 0)
                        cout << xalan.getLastError () << endl;
        } catch (...) {
                cout << "ERROR";
        };
}
BT:
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libstdc++-libc6.1-1.so.2...done.
Reading symbols from /usr/local/lib/libxalan-c1_3.so...done.
Reading symbols from /usr/local/lib/libxerces-c1_6_0.so...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libpthread.so.0...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x401abde6 in XalanDOMString::XalanDOMString () from
/usr/local/lib/libxalan-c1_3.so
(gdb) bt
#0  0x401abde6 in XalanDOMString::XalanDOMString () from
/usr/local/lib/libxalan-c1_3.so
#1  0x403560ec in XSLTEngineImpl::problem () from
/usr/local/lib/libxalan-c1_3.so
#2  0x403565b3 in XSLTEngineImpl::error () from
/usr/local/lib/libxalan-c1_3.so
#3  0x403276c2 in StylesheetConstructionContextDefault::error () from
/usr/local/lib/libxalan-c1_3.so
#4  0x4034042e in StylesheetHandler::error () from
/usr/local/lib/libxalan-c1_3.so
#5  0x40336776 in StylesheetHandler::processTopLevelElement () from
/usr/local/lib/libxalan-c1_3.so
#6  0x403336d6 in StylesheetHandler::startElement () from
/usr/local/lib/libxalan-c1_3.so
#7  0x40647e54 in SAXParser::startElement () from
/usr/local/lib/libxerces-c1_6_0.so
#8  0x40693c10 in XMLScanner::scanStartTag () from
/usr/local/lib/libxerces-c1_6_0.so
#9  0x40691a7e in XMLScanner::scanContent () from
/usr/local/lib/libxerces-c1_6_0.so
#10 0x4068f31d in XMLScanner::scanDocument () from
/usr/local/lib/libxerces-c1_6_0.so
#11 0x40647038 in SAXParser::parse () from
/usr/local/lib/libxerces-c1_6_0.so
#12 0x4037b66f in XercesParserLiaison::parseXMLStream () from
/usr/local/lib/libxalan-c1_3.so
#13 0x401dcecd in XalanSourceTreeParserLiaison::parseXMLStream () from
/usr/local/lib/libxalan-c1_3.so
#14 0x403506d4 in XSLTEngineImpl::processStylesheet () from
/usr/local/lib/libxalan-c1_3.so
#15 0x4034e2cb in XSLTEngineImpl::process () from
/usr/local/lib/libxalan-c1_3.so
#16 0x40382667 in XalanTransformer::transform () from
/usr/local/lib/libxalan-c1_3.so
#17 0x403841bd in XalanTransformer::transform () from
/usr/local/lib/libxalan-c1_3.so
#18 0x80495e0 in main (argc=1) at StreamTransform.cpp:95
Thanks,
Victor Popov


Reply via email to