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 Jason Jesso <jj...@global-matrix.com> on 2004/04/01 21:30:52 UTC
SimpleXPathAPI
I'm pretty doing what SimpleXPathAPI does (almost line by line).
When I run the SimpleXPathAPI it works fine, but when I run my program,
I get:
./_foo _foo.xml itXML "/itXML/TX"
Assertion failed: manager != 0, file XMemory.cpp, line 102
Abort(coredump)
I rounded it down to this line of code:
// Parse the document...
XalanDocument* const theDocument =
theLiaison.parseXMLStream(theInputSource);
Any ideas?
Re: SimpleXPathAPI
Posted by Jason Jesso <jj...@global-matrix.com>.
I am using AIX 5.2, Xerces C++ 2.4 and Xalan 1.7.
When I run the SimpleXPathAPI binary it works all OK, but I pretty much
copied the code to my own program and it doesn't work.
The code is:
int
main(
int argc,
char* argv[])
{
XALAN_USING_STD(cerr)
XALAN_USING_STD(cout)
XALAN_USING_STD(endl)
int theResult = 0;
if (argc != 4)
{
cerr << "Usage: SimpleXPathAPI XMLFilePath Context
XPathExpression" << endl;
theResult = -1;
}
else
{
try
{
XALAN_USING_XERCES(XMLPlatformUtils)
XALAN_USING_XALAN(XPathEvaluator)
XMLPlatformUtils::Initialize();
XPathEvaluator::initialize();
{
XALAN_USING_XERCES(LocalFileInputSource)
XALAN_USING_XALAN(XalanDocument)
XALAN_USING_XALAN(XalanDocumentPrefixResolver)
XALAN_USING_XALAN(XalanDOMString)
XALAN_USING_XALAN(XalanNode)
XALAN_USING_XALAN(XalanSourceTreeInit)
XALAN_USING_XALAN(XalanSourceTreeDOMSupport)
XALAN_USING_XALAN(XalanSourceTreeParserLiaison)
XALAN_USING_XALAN(XObjectPtr)
// Initialize the XalanSourceTree subsystem...
XalanSourceTreeInit theSourceTreeInit;
// We'll use these to parse the XML file.
XalanSourceTreeDOMSupport theDOMSupport;
XalanSourceTreeParserLiaison theLiaison(theDOMSupport);
// Hook the two together...
theDOMSupport.setParserLiaison(&theLiaison);
const XalanDOMString theFileName( "_foo.xml" );
// Create an input source that represents a local file...
const LocalFileInputSource theInputSource(theFileName.c_str());
// Parse the document...
XalanDocument* const theDocument =
theLiaison.parseXMLStream(theInputSource);
assert(theDocument != 0);
XalanDocumentPrefixResolver thePrefixResolver(theDocument);
XPathEvaluator theEvaluator;
// OK, let's find the context node...
XalanNode* const theContextNode =
theEvaluator.selectSingleNode(
theDOMSupport,
theDocument,
XalanDOMString(argv[2]).c_str(),
thePrefixResolver);
if (theContextNode == 0)
{
cerr << "Warning -- No nodes matched the location path \""
<< argv[2]
<< "\"."
<< endl
<< "Execution cannot continue..."
<< endl
<< endl;
}
else
{
// OK, let's evaluate the expression...
const XObjectPtr theResult(
theEvaluator.evaluate(
theDOMSupport,
theContextNode,
XalanDOMString(argv[3]).c_str(),
thePrefixResolver));
assert(theResult.null() == false);
cout << "The string value of the result is:"
<< endl
<< theResult->str()
<< endl
<< endl;
}
}
XPathEvaluator::terminate();
XMLPlatformUtils::Terminate();
}
catch(...)
{
cerr << "Exception caught!" << endl;
theResult = -1;
}
}
return theResult;
}
david_n_bertoni@us.ibm.com wrote:
>
>
>Hi Jason,
>
>It looks like an initialization problem with Xerces-C, or perhaps a bug
>related to the new Xerces-C pluggable memory management feature. Can you
>do the following:
>
> 1. Make sure you've initialized Xerces-C
> 2. Make sure you've initialized Xalan-C
>
>If you've done both, a stack trace would be interesting, because we need to
>see what MemoryManager instance is involved. Also, we need to know your
>platform/compiler and the version of Xerces-C you're using.
>
>Thanks!
>
>Dave
>
>
>
>|---------+--------------------------->
>| | "Jason Jesso" |
>| | <jjesso@global-m|
>| | atrix.com> |
>| | |
>| | 04/01/2004 11:30|
>| | AM |
>| | Please respond |
>| | to xalan-c-users|
>|---------+--------------------------->
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
> | |
> | To: xalan-c-users@xml.apache.org |
> | cc: (bcc: David N Bertoni/Cambridge/IBM) |
> | Subject: SimpleXPathAPI |
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>I'm pretty doing what SimpleXPathAPI does (almost line by line).
>
>When I run the SimpleXPathAPI it works fine, but when I run my program,
>I get:
>
>./_foo _foo.xml itXML "/itXML/TX"
>Assertion failed: manager != 0, file XMemory.cpp, line 102
>Abort(coredump)
>
>
>I rounded it down to this line of code:
>
> // Parse the document...
> XalanDocument* const theDocument =
> theLiaison.parseXMLStream(theInputSource);
>
>Any ideas?
>
>
>
>
>
>
>
Re: SimpleXPathAPI
Posted by Jason Jesso <jj...@global-matrix.com>.
I am using cc_r C for AIX Compiler, Version 6.
david_n_bertoni@us.ibm.com wrote:
>
>
>Hi Jason,
>
>It looks like an initialization problem with Xerces-C, or perhaps a bug
>related to the new Xerces-C pluggable memory management feature. Can you
>do the following:
>
> 1. Make sure you've initialized Xerces-C
> 2. Make sure you've initialized Xalan-C
>
>If you've done both, a stack trace would be interesting, because we need to
>see what MemoryManager instance is involved. Also, we need to know your
>platform/compiler and the version of Xerces-C you're using.
>
>Thanks!
>
>Dave
>
>
>
>|---------+--------------------------->
>| | "Jason Jesso" |
>| | <jjesso@global-m|
>| | atrix.com> |
>| | |
>| | 04/01/2004 11:30|
>| | AM |
>| | Please respond |
>| | to xalan-c-users|
>|---------+--------------------------->
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
> | |
> | To: xalan-c-users@xml.apache.org |
> | cc: (bcc: David N Bertoni/Cambridge/IBM) |
> | Subject: SimpleXPathAPI |
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>I'm pretty doing what SimpleXPathAPI does (almost line by line).
>
>When I run the SimpleXPathAPI it works fine, but when I run my program,
>I get:
>
>./_foo _foo.xml itXML "/itXML/TX"
>Assertion failed: manager != 0, file XMemory.cpp, line 102
>Abort(coredump)
>
>
>I rounded it down to this line of code:
>
> // Parse the document...
> XalanDocument* const theDocument =
> theLiaison.parseXMLStream(theInputSource);
>
>Any ideas?
>
>
>
>
>
>
>
Re: SimpleXPathAPI
Posted by da...@us.ibm.com.
Hi Jason,
It looks like an initialization problem with Xerces-C, or perhaps a bug
related to the new Xerces-C pluggable memory management feature. Can you
do the following:
1. Make sure you've initialized Xerces-C
2. Make sure you've initialized Xalan-C
If you've done both, a stack trace would be interesting, because we need to
see what MemoryManager instance is involved. Also, we need to know your
platform/compiler and the version of Xerces-C you're using.
Thanks!
Dave
|---------+--------------------------->
| | "Jason Jesso" |
| | <jjesso@global-m|
| | atrix.com> |
| | |
| | 04/01/2004 11:30|
| | AM |
| | Please respond |
| | to xalan-c-users|
|---------+--------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| To: xalan-c-users@xml.apache.org |
| cc: (bcc: David N Bertoni/Cambridge/IBM) |
| Subject: SimpleXPathAPI |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
I'm pretty doing what SimpleXPathAPI does (almost line by line).
When I run the SimpleXPathAPI it works fine, but when I run my program,
I get:
./_foo _foo.xml itXML "/itXML/TX"
Assertion failed: manager != 0, file XMemory.cpp, line 102
Abort(coredump)
I rounded it down to this line of code:
// Parse the document...
XalanDocument* const theDocument =
theLiaison.parseXMLStream(theInputSource);
Any ideas?