I did exactly this (with help from Dave, Thanks Dave!) for an XML
configuration file reader I just wrote.  I put the XalanDocument*,
XalanSourceTreeInit, XalanSourceTreeDOMSupport, and
XalanSourceTreeParserLiaison in class member data.  Works fine.  Crazy
busy for the next couple of hours but I'll post up some code snippets
first chance I get.

-will

-----Original Message-----
From: David Bertoni [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 28, 2007 5:09 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan parser in a class

Coker, Jonathan M wrote:
> Hello,
>    Most of the examples I have seen have all of the Xalan code in a
> single routine.  I would like to wrap this in a class and break some
of
> the functionality into different member functions.  For example, I
would
> like to create a function that would take node as an argument then use
> it for the context node to evaluate a path.  In order to do this it
> seems like some of the things that are created (XercescDOMSupport,
> XercesParserLiason, etc.) are good candidates for data members on the
> class.  Does this seem reasonable or am I going to have a lot of
trouble
> trying to do this?

It's a reasonable thing, and essential if you're concerned with object 
lifetimes.  For example, any documents you create with a 
XercesParserLiaison instance are destroyed when that instance goes out
of 
scope.

As a side note, I would encourage you to use Xalan-C's default source
tree 
implementation, rather than the Xerces-C DOM, unless your application
has a 
specific need for the Xerces-C DOM.

Dave

Reply via email to