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 XalanParsedSource* parsedSourcePtr = &parsedSource; theXalanTransformer.parseSource(theInputSource, parsedSourcePtr); XalanDocument* xDoc = parsedSourcePtr->getDocument(); ////////////////////////////////////////////// The line indicated throws an (unkown) exception. I have used a Xalan/Xerces/XPath to get data out of files before, but parsing a string/stream is giving me problems. Any advice or corrections would be appreciated. -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Friday, June 29, 2007 7:34 PM To: xalan-c-users@xml.apache.org Subject: Re: Document from a string Coker, Jonathan M wrote: > Another document creation question: Is there a way to create a > parsable document from a standard c++ string (or char*)? I have a > string, not in a file, not broken into a char array. It is well > formed XML and I would lke to be able to use XPath to acces the > information. I have looked through the different ways to create a > document, including XalanTransformer::parseSource, but have not seen > the leap from a string to an acceptable input source. I thought > XSLTInputSource might work but I could not see what was needed for the public and system Id values. > Nudges in the right direction are appreciated. Take a look at the StreamTransform sample. Basically, you can use any std::istream-derived class as input for the source tree or the stylesheet. Dave