Hello,
I evaluate an _expression_ and check
the result to see if the node has a value.
When the value is empty i.e. "" then
I would like to insert a default value for the particular node.
My code:
**************************************************************************************************
const XObjectPtr
theResult(theEvaluator.evaluate(theDOMSupport,
theDocument,
XalanDOMString("/doc/name[@first='Tom']").c_str(),
thePrefixResolver));
assert(theResult.null() == false);
const CharVectorType
localResultVec(TranscodeToLocalCodePage(theResult->str()));
if(strcmp("",
(c_str(localResultVec))) == 0)
{
XalanNode* const
theEmptyNode = theEvaluator.selectSingleNode(
theDOMSupport,
theDocument,
XalanDOMString("/doc/name[@first='Tom']").c_str(),
thePrefixResolver);
XalanDOMString testString("Hello");
theEmptyNode->setNodeValue(testString);
}
**************************************************************************************************
I get a assertion failed error on
m_referenceCount == 0 coming from file XalanReferenceCountedObject.cpp.
What am I doing wrong? How can I
set the value of the node when it is empty?
on the xalan FAQ web page they say that if u wanna modifiy a DOM
document you should use Xerces instead of Xalan: