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 Sanjoy Ghosh <sa...@yahoo.com> on 2004/11/08 19:07:02 UTC

XPathFactory limitation

Hello,

Is there a limit on the number of XPaths that can be created from a
XPathFactory.

I find that after creating a number of XPaths with code of the form:

  XPath* const  partyPath = theXPathFactory.create();
  theXPathProcessor.initXPath( *partyPath, theXPathConstructionContext,
   XalanDOMString( "/fpml:FpML/dswg:party"), thePrefixResolver);

If I add one more such call, it throws an exception as does every other
XPath creation attempt after that.

Is there any way to increase the number of XPaths that can be created from a
XPathFactory.  Also what is the way release XPaths after they are no longer
needed?

I am using XPathFactoryDefault.  Should I switch to XPathFactoryBlock?  What
is a block?

Any help would be greatly appreciated.

Thanks,
Sanjoy Ghosh

Re: XPathFactory limitation

Posted by da...@us.ibm.com.
> Is there a limit on the number of XPaths that can be created from a
> XPathFactory.

Only limitations based on the amount of available memory.

> I find that after creating a number of XPaths with code of the form:
> 
>   XPath* const  partyPath = theXPathFactory.create();
>   theXPathProcessor.initXPath( *partyPath, theXPathConstructionContext,
>    XalanDOMString( "/fpml:FpML/dswg:party"), thePrefixResolver);

There should be no problem creating multiple XPath instances.

> If I add one more such call, it throws an exception as does every other
> XPath creation attempt after that.

This either a bug in our code, or a bug in your code.  Please post a 
_minimal_ code snippet that reproduces the problem, and give us your 
platform and compiler information.

> Is there any way to increase the number of XPaths that can be created
> from a XPathFactory.  Also what is the way release XPaths after they
> are no longer needed?

Since the only limitation is based on available memory, there is no way to 
increase the capacity.  You can use XPathFactory::returnObject() once 
you've finished using the XPath instance.

> I am using XPathFactoryDefault.  Should I switch to XPathFactoryBlock? 
What
> is a block?

Probably not.  XPathFactoryBlock does block allocation of XPath instances, 
and is only appropriate if you're going to create a large number of XPath 
instances and destroy them all at once.

Dave