Thanks Dave for the quick reply, I'll try what you suggest.

-will

-----Original Message-----
From: David Bertoni [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 12, 2007 1:50 AM
To: xalan-c-users@xml.apache.org
Subject: Re: Problem evaluating XPath expressions

Will Sappington wrote:
> Hello all,
> 
>  
> 
> I'm writing a configuration utility that we call an "application 
> profile" or simply profile, that is essentially an ini file on 
> steroids.  It's a hierarchical structure - application/section/item - 
> that allows multiple applications to use a single profile.  I'm 
> migrating it from "key = value" format to XML and I'm using
Xalan/Xerces 
> for evaluating XPath expressions to retrieve the configuration items.
>

...

> 
> XalanDocumentPrefixResolver     thePrefixResolver(_pXmlDoc);
> 
>  
> 
> where _pXmlDoc is in the Profile class private member data
>

 From looking at your code, I suspect the _pXmlDoc data member is
pointing 
to an instance that's already been destroyed.

Here's what the comments for XMLParserLiason::parseXMLStream() say:

/**
  * Parse the text pointed at by the reader as XML, and return a DOM
  * Document interface.  It is recommended that you pass in some sort of
  * recognizable name, such as the filename or URI, with which the
reader
  * can be recognized if the parse fails.
  *
  * The liaison owns the XalanDocument instance, and will delete it when
  * when asked (see DestroyDocument()), or when the liaison is reset, or
  * goes out of scope.
  */

So, the instance you created is destroyed when the 
XalanSourceTreeParserLiaison instance is destroyed in
Profile::_openXmlDoc().

In general, Xalan-C implements very tightly controlled ownership of 
objects.  The easiest way for you to handle this is to make the 
XalanSourceTreeParserLiason instance a member of your class.

Dave

Reply via email to