Coker, Jonathan M wrote:
Thank you for the suggestion. The StreamTransform seemed to very close to what I was trying to do. However, since I just wanted to get a XalanDocument*, I tried using XalanTransformer::parseSource. This is what I ended up with://///////////////////////////////// XalanSourceTreeInit theSourceTreeInit; string testXML("<TESTING></TESTING>"); istringstream theXMLStream(testXML); XSLTInputSource theInputSource(&theXMLStream); theInputSource.setSystemId(XalanDOMString("foo").c_str()); XalanDefaultParsedSource parsedSource(theInputSource); //Throws unknown exception
Rather than creating this yourself, you should call XalanTransformer::createParsedSource(). Or, you should pass in an ErrorHandler instance so you can see what sort of error is reported.
XalanParsedSource* parsedSourcePtr = &parsedSource; theXalanTransformer.parseSource(theInputSource, parsedSourcePtr);
XalanTransformer::parseSource() creates an instance of a XalanParsedSource for you, based on the supplied XSLTInputSource, but you're providing a pointer to a pre-existing instance of XalanDefaultParsedSource. You're also re-using an existing XSLTInputSource, which may or may not work, depending on the source of the data. In this case, in won't work, because the istringstream is already at the end of the stream. What happens if you start with the StreamTransform sample, and just substitute your code for the existing code? I modified the sample to use std::string and istringstream and it works just fine. Dave
