You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Will Sappington <ws...@ndma.us> on 2007/02/15 23:00:46 UTC

Xalan initialization

While researching the XPath evaluator question I came across something
that raised a question about Xalan initialization so I'll ask it while I
continue digging.

I came across the following in the mail list archive, dated 2006-04-26,
re: "Regarding XPath query":

As I said previously, the best thing to do is to call
> XalanTransformer::initialize() in main(), and remove any usage of the
> "Init" classes.

The sample app on which the code I'm writing is based - SimpleXPathAPI -
calls XMLPlatformUtils::Initialize() and XPathEvaluator::initialize()
and also instantiates a XalanSourceTreeInit class.

My code does exactly this and is working.  The example code Dave sent me
in a previous post uses XalanTransformer::initialize() instead of
XPathEvaluator::initialize().

Q: should I replace XPathEvaluator::initialize() with
XalanTransformer::initialize()?  (probably yes)

Q: do I still need the XalanSourceTreeInit class? (really don't know)

Thank you in advance,

-will

RE: Xalan initialization

Posted by Will Sappington <ws...@ndma.us>.
-----Original Message-----
From: David Bertoni [mailto:dbertoni@apache.org] 
Sent: Thursday, February 15, 2007 5:48 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Xalan initialization

Will Sappington wrote:
> While researching the XPath evaluator question I came across something
> that raised a question about Xalan initialization so I'll ask it while
I
> continue digging.
> 
> I came across the following in the mail list archive, dated
2006-04-26,
> re: "Regarding XPath query":
> 
> As I said previously, the best thing to do is to call
>> XalanTransformer::initialize() in main(), and remove any usage of the
>> "Init" classes.
> 
> The sample app on which the code I'm writing is based - SimpleXPathAPI
-
> calls XMLPlatformUtils::Initialize() and XPathEvaluator::initialize()
> and also instantiates a XalanSourceTreeInit class.
> 
> My code does exactly this and is working.  The example code Dave sent
me
> in a previous post uses XalanTransformer::initialize() instead of
> XPathEvaluator::initialize().

What you're doing is fine, but not everything is initialized when you do
this.

> 
> Q: should I replace XPathEvaluator::initialize() with
> XalanTransformer::initialize()?  (probably yes)

This initializes more stuff, so it will use more memory, etc.  The 
advantage is you avoid mysterious crashes when you start using something
in 
  another subsystem, and you forgot to do further initialization.

> 
> Q: do I still need the XalanSourceTreeInit class? (really don't know)

If you use XalanTransformer::initialize(), then you don't need 
XPathEvaluator::initialize() or XalanSourceTreeInit.  For more details, 
take a look at what XalanTransformer::initialize() does, vs. what 
XPathEvaluator::initialize() does, vs. what the class
XalanSourceTreeInit does.

Dave

==================

Thank you,

-will

Re: Xalan initialization

Posted by David Bertoni <db...@apache.org>.
Will Sappington wrote:
> While researching the XPath evaluator question I came across something
> that raised a question about Xalan initialization so I'll ask it while I
> continue digging.
> 
> I came across the following in the mail list archive, dated 2006-04-26,
> re: "Regarding XPath query":
> 
> As I said previously, the best thing to do is to call
>> XalanTransformer::initialize() in main(), and remove any usage of the
>> "Init" classes.
> 
> The sample app on which the code I'm writing is based - SimpleXPathAPI -
> calls XMLPlatformUtils::Initialize() and XPathEvaluator::initialize()
> and also instantiates a XalanSourceTreeInit class.
> 
> My code does exactly this and is working.  The example code Dave sent me
> in a previous post uses XalanTransformer::initialize() instead of
> XPathEvaluator::initialize().

What you're doing is fine, but not everything is initialized when you do this.

> 
> Q: should I replace XPathEvaluator::initialize() with
> XalanTransformer::initialize()?  (probably yes)

This initializes more stuff, so it will use more memory, etc.  The 
advantage is you avoid mysterious crashes when you start using something in 
  another subsystem, and you forgot to do further initialization.

> 
> Q: do I still need the XalanSourceTreeInit class? (really don't know)

If you use XalanTransformer::initialize(), then you don't need 
XPathEvaluator::initialize() or XalanSourceTreeInit.  For more details, 
take a look at what XalanTransformer::initialize() does, vs. what 
XPathEvaluator::initialize() does, vs. what the class XalanSourceTreeInit does.

Dave