本文整理汇总了C++中XPathExecutionContext::error方法的典型用法代码示例。如果您正苦于以下问题:C++ XPathExecutionContext::error方法的具体用法?C++ XPathExecutionContext::error怎么用?C++ XPathExecutionContext::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPathExecutionContext
的用法示例。
在下文中一共展示了XPathExecutionContext::error方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XObjectPtr
XObjectPtr
FunctionGenerateID::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const LocatorType* locator) const
{
if (context == 0)
{
executionContext.error(
XalanMessageLoader::getMessage(XalanMessages::FunctionRequiresNonNullContextNode_1Param,"generate-id()"),
context,
locator);
return XObjectPtr();
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theID(executionContext);
theID.get() = XalanUnicode::charLetter_N;
getSuffix(context, theID.get());
return executionContext.getXObjectFactory().createString(theID);
}
}
示例2:
XObjectPtr
XalanEXSLTFunctionObjectType::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const LocatorType* locator) const
{
// Make sure nothing's happened to our strings and that
// they were actually initialized...
assert(XalanDOMString::equals(m_boolean, s_booleanString) == true);
assert(XalanDOMString::equals(m_external, s_externalString) == true);
assert(XalanDOMString::equals(m_nodeSet, s_nodeSetString) == true);
assert(XalanDOMString::equals(m_number, s_numberString) == true);
assert(XalanDOMString::equals(m_rtf, s_rtfString) == true);
assert(XalanDOMString::equals(m_string, s_stringString) == true);
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
const XalanDOMString* theResult = &m_external;
switch(args[0]->getType())
{
case XObject::eTypeBoolean:
theResult = &m_boolean;
break;
case XObject::eTypeNodeSet:
theResult = &m_nodeSet;
break;
case XObject::eTypeNumber:
theResult = &m_number;
break;
case XObject::eTypeResultTreeFrag:
theResult = &m_rtf;
break;
case XObject::eTypeString:
theResult = &m_string;
break;
default:
break;
}
assert(theResult != 0);
return executionContext.getXObjectFactory().createStringReference(*theResult);
}
示例3: theGuard
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const LocatorType* locator) const
{
if (args.size() != 2)
{
XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
executionContext.error(getError(theGuard.get()), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
const NodeRefListBase& nodeset1 = args[0]->nodeset();
const NodeRefListBase& nodeset2 = args[1]->nodeset();
const NodeRefListBase::size_type theLength = nodeset1.getLength();
bool fResult = true;
if (theLength != nodeset2.getLength())
{
fResult = false;
}
else
{
for (NodeRefListBase::size_type i = 0; i < theLength && fResult == true; ++i)
{
XalanNode* const theNode = nodeset1.item(i);
assert(theNode != 0);
if (nodeset2.indexOf(theNode) == NodeRefListBase::npos)
{
fResult = false;
}
}
}
return executionContext.getXObjectFactory().createBoolean(fResult);
}
示例4: XalanDOMString
XALAN_CPP_NAMESPACE_USE
/**
* Execute an XPath function object. The function must return a valid
* XObject.
*
* @param executionContext executing context
* @param context current context node
* @param opPos current op position
* @param args vector of pointers to XObject arguments
* @return pointer to the result XObject
*/
XObjectPtr FunctionBase64::execute( XPathExecutionContext& executionContext, XalanNode* context, const XObjectArgVectorType& args, const LocatorType* locator ) const
{
XALAN_USING_XALAN( XalanDOMString );
if ( args.size() != 3 )
{
stringstream errorMessage;
errorMessage << "The Base64() function takes 3 arguments [ nodeset, trailer, envelope ], but received " << args.size();
#if (_XALAN_VERSION >= 11100)
executionContext.problem( XPathExecutionContext::eXPath, XPathExecutionContext::eError, XalanDOMString( errorMessage.str().c_str() ), locator, context);
#else
executionContext.error( XalanDOMString( errorMessage.str().c_str() ), context );
#endif
}
stringstream stringToEncode;
string envelopeName = localForm( ( const XMLCh* )( args[ 2 ]->str().data() ) );
stringToEncode << "<" << envelopeName << ">";
for( unsigned int i=0; i<args[ 0 ]->nodeset().getLength(); i++ )
{
stringToEncode << XPathHelper::SerializeToString( args[ 0 ]->nodeset().item( i ) );
}
stringToEncode << localForm( ( const XMLCh* )( args[ 1 ]->str().data() ) ) << "</" << envelopeName << ">";
string encodedString = Base64::encode( stringToEncode.str() );
return executionContext.getXObjectFactory().createString( unicodeForm( encodedString ) );
}
示例5: XObjectPtr
XObjectPtr
FunctionString::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const LocatorType* locator) const
{
if (context == 0)
{
XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theResult = theGuard.get();
executionContext.error(
XalanMessageLoader::getMessage(
theResult,
XalanMessages::FunctionRequiresNonNullContextNode_1Param,
"string"),
context,
locator);
// Dummy return value...
return XObjectPtr();
}
else
{
// The XPath standard says that if there are no arguments,
// the argument defaults to a node set with the context node
// as the only member. The string value of a node set is the
// string value of the first node in the node set.
// DOMServices::getNodeData() will give us the data.
// Get a cached string...
XPathExecutionContext::GetAndReleaseCachedString theData(executionContext);
XalanDOMString& theString = theData.get();
DOMServices::getNodeData(*context, theString);
return executionContext.getXObjectFactory().createString(theData);
}
}
示例6: execute
XALAN_CPP_NAMESPACE_USE
/**
* Execute an XPath function object. The function must return a valid
* XObject.
*
* @param executionContext executing context
* @param context current context node
* @param opPos current op position
* @param args vector of pointers to XObject arguments
* @return pointer to the result XObject
*/
XObjectPtr FunctionHash::execute( XPathExecutionContext& executionContext, XalanNode* context, const XObjectArgVectorType& args, const LocatorType* locator ) const
{
if ( args.size() != 1 )
{
stringstream errorMessage;
errorMessage << "The Hash() function takes one argument! [ stringToCRC ], but received " << args.size();
#if (_XALAN_VERSION >= 11100)
executionContext.problem( XPathExecutionContext::eXPath, XPathExecutionContext::eError, XalanDOMString( errorMessage.str().c_str() ), locator, context);
#else
executionContext.error( XalanDOMString( errorMessage.str().c_str() ), context );
#endif
}
string stringToCalculateCRC = localForm( ( const XMLCh* )( args[0]->str().data() ) );
//DEBUG( "Expression to calculate crc for : [" << stringToCalculateCRC << "]" );
stringstream messageHash;
/*MD5 md5Value;
md5Value.update( ( unsigned char* )&stringToCalculateCRC , stringToCalculateCRC.length() );
md5Value.finalize ();
*/
//DEBUG( "MD5 = [" << md5Value.hex_digest() << "]" );
//return executionContext.getXObjectFactory().createString( unicodeForm( md5Value.hex_digest() ) );
return executionContext.getXObjectFactory().createString( unicodeForm( md5( stringToCalculateCRC ).c_str() ) );
}