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!









Reply via email to