Return-Path: Delivered-To: apmail-xml-xalan-c-users-archive@xml.apache.org Received: (qmail 13451 invoked by uid 500); 30 Jul 2002 21:49:32 -0000 Mailing-List: contact xalan-c-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list xalan-c-users@xml.apache.org Received: (qmail 13444 invoked from network); 30 Jul 2002 21:49:32 -0000 Received: from lotus2.lotus.com (129.42.248.42) by daedalus.apache.org with SMTP; 30 Jul 2002 21:49:32 -0000 Received: from internet2.lotus.com (internet2 [172.16.131.236]) by lotus2.lotus.com (8.12.3/8.12.1) with ESMTP id g6ULpjJB019590 for ; Tue, 30 Jul 2002 17:51:45 -0400 (EDT) Received: from a3mail.lotus.com (a3mail.lotus.com [9.33.9.65]) by internet2.lotus.com (8.12.3/8.12.1) with ESMTP id g6ULnbM6025092 for ; Tue, 30 Jul 2002 17:49:37 -0400 (EDT) Subject: RE: How to use DocumentBuilder? To: "'xalan-c-users@xml.apache.org'" X-Mailer: Lotus Notes Release 5.0.6a January 17, 2001 Message-ID: From: David N Bertoni/Cambridge/IBM Date: Tue, 30 Jul 2002 14:50:12 -0700 X-MIMETrack: Serialize by Router on A3MAIL/CAM/H/Lotus(Build V60_M14_07162002NP Release Candidate|July 16, 2002) at 07/30/2002 05:49:40 PM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Status: O X-Status: X-Keywords: X-UID: 70 Hi Kevin, Please make sure your replies go the list, instead of to my individual address. If you want to use the new Xerces DOM then you are out of luck when it comes to transforming with Xalan. Xalan supports the old DOM, but not the new one. When and if such support will ever be available is up-in-the-air. It's a lot of work, and I'm too busy to do it right now, and I'm not sure I even want to do it at all. If you really must create the source with the new Xerces DOM, then you have two choices: 1. Create a DOM instance using the new Xerces DOM, then serialize that tree and have Xalan parse it. 2. Create a DOM instance using the new Xerces DOM, then walk it and send SAX2 events to an instance of XalanDocumentBuilder. You can take a look at the following classes for some ideas on how to walk a DOM instance in document order and send SAX : DOMSupport/TreeWalker.cpp XMLSupport/FormatterTreeWalker.cpp If you decide to go with #2, we could certainly collaborate on writing the code, and work it back into Xalan. You could also consider building the tree through SAX2 events. You would know better based on your current code how feasible that it. Of course, this is only possible if you can build the DOM instance in document order. Dave "Xiao, Ke" tegy.com> cc: Subject: RE: How to use DocumentBuilder? 07/30/2002 02:30 PM Hi Dave, Thanks a lot for your reply. I use XercesDOMWrapperParsedSource before, and the transformation time is too long. This is the one reason I try to create the Xalan internal source tree from Xerces DOM tree instead of using that wrapper. Another reason is now I am using Xerces V2.0, Xalan1.3 does not support the new DOM , so I have to create the source tree by myself. Any suggestions for this? Do we have any plans to integrate with the latest xerces? Do we have any tips to use Xalan more efficiently? Thanks again. Kevin -----Original Message----- From: David N Bertoni/Cambridge/IBM [mailto:david_n_bertoni@us.ibm.com] Sent: Tuesday, July 30, 2002 5:25 PM To: 'xalan-c-users@xml.apache.org' Subject: Re: How to use DocumentBuilder? Yes, XalanDocumentBuilder _only_ supports building a document through SAX2 calls. That's the only way you can use Xalan's internal source tree implementation, which is what XalanDocumentBuilder uses for its implementation. If you really must use DOM calls, you can use the Xerces DOM interfaces, then follow this usage pattern to do a transformation: http://xml.apache.org/xalan-c/usagepatterns. html#xercesdomwrapperparsedsource However, be prepared for longer transformation times and greater memory usage. Dave "Xiao, Ke" tegy.com> cc: (bcc: David N Bertoni/Cambridge/IBM) Subject: How to use DocumentBuilder? 07/30/2002 02:07 PM Hi,all I want to use DocumentBuilder to create a Xalan Document for transform, but it always fails. My code is like: XalanTransformer theXalanTransformer; // Get a document builder from the transformer... XalanDocumentBuilder* const theBuilder = theXalanTransformer. createDocumentBuilder(); XalanDocument *lpDoc = theBuilder->getDocument(); When I try to use lpDoc to create any XalanElement or other nodes, it always fails. I debug the code and find that the lpDoc is a XalanSourceTreeDocument class, all creatXXX methods in that class are not supported and throw an exception. There is a DocumentBuilder sample in Xalan, but it use SAX2 ContentHandler from the DocumentBuilder to create the document. Does this mean that DocumentBuilder only support SAX2 content handler , but do not support any DOM here? Do I have any other ways to solve this? Thanks a lot,