Hi! The technique used in DocumentBuilder is exactly what I want to use in our process. However, the Document builder app coredumps when executed. Here is the call stack.
=>[1] ReaderMgr::reset(0x0, 0xffffffff7d9ff368, 0xffffffff78b0c09c, 0x0, 0x0, 0x1063c4), at 0xffffffff7d92e888 [2] XMLScanner::scanDocument(0x10019ad30, 0xffffffff7fffec20, 0x0, 0x1001412b0, 0xffffffff7d700030, 0xffffffff7df21fb0), at 0xffffffff7d97528c [3] SAXParser::parse(0x10019ac90, 0xffffffff7fffec20, 0x0, 0xffffffff7d295cec, 0x0, 0x0), at 0xffffffff7d93fa0c [4] XercesParserLiaison::parseXMLStream(0x10019ac90, 0x1, 0xffffffff7fffd988, 0xffffffff7fffd838, 0xffffffff7fffdb68, 0xffffffff7fffdb40), at 0xffffffff7d2b48cc [5] XSLTEngineImpl::processStylesheet(0xffffffff7fffdbc8, 0x100198350, 0xffffffff7fffe378, 0xffffffff7d2b9c08, 0x1f21b4, 0xffffffff7d2a18ac), at 0xffffffff7d295cec [6] XSLTEngineImpl::process(0xffffffff7fffe2c0, 0x10016cde0, 0xffffffff7fffe2f8, 0x0, 0xffffffff7fffe378, 0x10016b500), at 0xffffffff7d294cc8 [7] XalanTransformer::transform(0x100197100, 0x10016cbf0, 0xffffffff7fffec20, 0x100197108, 0xffffffff7fffe9f8, 0xffffffff7fffe718), at 0xffffffff7d2b9c08 [8] main(0x1, 0xffffffff7fffedc8, 0xffffffff7fffedd8, 0x0, 0x0, 0x100000000), at 0x10000f984 Any ideas why this may be happening. I have been successful with XalanTransformer::transform() using LocalFileInputSource and writing XSLTResultTarget to file. Thanks! Matt Hanson! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 03, 2001 2:39 PM To: [email protected] Subject: RE: Type:RuntimeException, Message:The primary document entity could not be opened. Id={null} You just pass the XalanDocumentBuilder instance as a parameter to transform (). If you look at the header file, you'll see it's derived from XalanParsedSource. There is a sample called DocumentBuilder that you should look at for more information. Dave Matthew James Hanson To: [email protected] <matthew.hanson@ cc: (bcc: David N Bertoni/CAM/Lotus) wcom.com> Subject: RE: Type:RuntimeException, Message:The primary document entity could not be opened. Id={null} 12/03/2001 03:34 PM After getting the XalanDocument from XalanDocumenBuilder, do I then pass the XalanDocumentBuilder as a parameter to XalanTransformer::transform(const XalanParsedSource& theParsedSource, ...)? Thanks! Matt Hanson! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 03, 2001 12:47 PM To: [email protected] Subject: RE: Type:RuntimeException, Message:The primary document entity could not be opened. Id={null} Hi Matt, There's no need to cc me when replying to the mailing list -- I'll just end up with two copies of everything. I'm having trouble understanding exactly what you need to do. If the database process is not producing serialized XML, then you should consider using the class XalanDocumentBuilder, which allows you to to build a document programatically, using SAX events. Thus, there's no parser involved and no need to have serialized XML. If your database process _does_ produce serialized XML, then you can use any sort of stream input (file, memory buffer, etc.) as a source for the input. There's a sample called StreamTransform which uses an istrstream as input to the transformation. > To create XML, this database information would need to be parsed via either the > DOM or SAX parser, only to be converted to an XML string. This doesn't make any sense to me. A parser can only work from a stream of XML, so if you don't have an XML stream, what good does a parser do you? Are you saying that you're building a DOM programatically using the DOM APIs? If so, then just use a XalanDocumentBuilder instance and use SAX events rather than creating DOM nodes. See XalanTransformer/XalanDocumentBuilder.hpp and the member functions XalanTransformer::createDocumentBuilder(), and XalanTransformer::destroyDocumentBuilder() for more information. Dave Matthew James Hanson To: [EMAIL PROTECTED], <matthew.hanson@ [email protected] wcom.com> cc: (bcc: David N Bertoni/CAM/Lotus) Subject: RE: Type:RuntimeException, Message:The primary 12/03/2001 01:36 document entity could not be opened. Id={null} PM Hi, David! DOM was our original input source idea because input to the XSLT processor will not be located in a file or stream, but from a database process. To create XML, this database information would need to be parsed via either the DOM or SAX parser, only to be converted to an XML string. As a string or DOM tree, the DOM document would nevertheless be created. I mainly just want the process to be as fast as possible and avoid any multiple parse runs for the input source. The input XML docs or trees, etc., can definitely be very large. I would really appreciate any suggestions you might have! Thanks, a lot! Matt Hanson -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 03, 2001 10:36 AM To: [email protected] Subject: Re: Type:RuntimeException, Message:The primary document entity could not be opened. Id={null} There is new functionality to work with the DOM using the XalanTransformer. You can get it by checking out the latest code from the CVS repository. Otherwise, you can wait until the next release, when it will be included with the distribution. For more information, you can search the bug database. In general, it's a bad idea to use the Xerces DOM for transformations. Depending on the size of the document, and the nature of your stylesheets, using the DOM can be up to an order of magnitude slower and have much higher memory requirements. Unless you have some specific need to use the DOM, don't do it -- let Xalan build its own source tree. Dave Matthew James Hanson To: [email protected] <matthew.hanson@ cc: (bcc: David N Bertoni/CAM/Lotus) wcom.com> Subject: Type:RuntimeException, Message:The primary document entity could not be opened. Id={null} 12/03/2001 12:18 PM Hi! We are trying to use XalanC++ to tranform XML docs to FO. I am beginning to test the library, and using non-DOM XSLTInputSource objs as the XML parameter to the XalanTransformer works just fine. However, an exception is thrown when I use the following code, hoping to use DOM as an input source: XMLPlatformUtils::Initialize(); XalanTransformer::initialize(); XalanTransformer theXalanTranformer; DOMParser theParser; theParser.setToCreateXMLDeclTypeNode(false); theParser.parse("foo.xml"); const DOM_Document theDOM = theParser.getDocument(); XercesDOMSupport theDOMSupport; XercesParserLiaison theParserLiaison(theDOMSupport); XalanDocument * theDoc = theParserLiaison.createDocument(theDOM); XSLTInputSource xmlIn(theDoc); XSLTInputSource xslIn("foo.xsl"); std::ostringstream strm; XSLTResultTarget xmlOut(strm); int theResult = theXalanTranformer.transform(xmlIn, xslIn, xmlOut); This sample code is very similar to the usage patterns at xml.apache.org. Please help! I am also interested in information on performance issues when using DOM XML input to the XalanTransformer. There is a caveat in the documentation that seems to recommend against using the DOM. Is file based input preferred, and if so, how much faster? Thanks! Matt Hanson!
