• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XPathExecutionContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XPathExecutionContext的典型用法代码示例。如果您正苦于以下问题:C++ XPathExecutionContext类的具体用法?C++ XPathExecutionContext怎么用?C++ XPathExecutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XPathExecutionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
开发者ID:,项目名称:,代码行数:26,代码来源:


示例2: assert

XObjectPtr
FunctionFormatNumber::execute(
			XPathExecutionContext&	executionContext,
			XalanNode*				context,
			const XObjectPtr		arg1,
			const XObjectPtr		arg2,
			const XObjectPtr		arg3,
			const LocatorType*		locator) const
{
	assert(arg1.null() == false && arg2.null() == false && arg3.null() == false);
	
	const double						theNumber = arg1->num();
	const XalanDOMString&				thePattern = arg2->str();

	const XalanDOMString&				theDFSName = arg3->str();
	assert(length(theDFSName) != 0);
	
	typedef XPathExecutionContext::GetAndReleaseCachedString	GetAndReleaseCachedString;

	GetAndReleaseCachedString	theString(executionContext);

	executionContext.formatNumber(
		theNumber, 
		thePattern,
		theDFSName,
		theString.get(),
		context, 
		locator);

	return executionContext.getXObjectFactory().createString(theString);
}
开发者ID:,项目名称:,代码行数:31,代码来源:


示例3:

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);
}
开发者ID:,项目名称:,代码行数:55,代码来源:


示例4: assert

XObjectPtr
FunctionElementAvailable::execute(
            XPathExecutionContext&  executionContext,
            XalanNode*              /* context */,          
            const XObjectPtr        arg1,
            const LocatorType*      locator) const
{
    assert(arg1.null() == false);

    return executionContext.getXObjectFactory().createBoolean(
        executionContext.elementAvailable(arg1->str(), locator));
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:12,代码来源:FunctionElementAvailable.cpp


示例5: CurrentNodePushAndPop

 CurrentNodePushAndPop(
         XPathExecutionContext&  theExecutionContext,
         XalanNode*              theNewNode) :
     m_executionContext(theExecutionContext)
 {
     theExecutionContext.pushCurrentNode(theNewNode);
 }
开发者ID:apache,项目名称:xalan-c,代码行数:7,代码来源:XPathExecutionContext.hpp


示例6: execute

XObjectPtr CExternalFunction::execute( XPathExecutionContext&   executionContext,
                                    XalanNode*              /* context */,
                                    const XObjectPtr        arg1,
                                    const Locator*          /* locator */) const
{
    assert(arg1.null() == false);
    const XalanDOMString& arg = arg1->str();

    //convert XalanDOMString (implemented as unsigned short*) into StringBuffer
    StringBuffer sbInput;
    sbInput.ensureCapacity(arg.length()+1);

    size32_t len = arg.length();
    for (size32_t i=0; i < len; i++)
        sbInput.append( (char) arg[i]);

    StringBuffer sbOutput;

    try
    {
        (*m_userFunction)(sbOutput, sbInput.str(), m_pTransform);
    }
    catch (IException* e)
    {
        StringBuffer msg;
        e->errorMessage(msg);
        e->Release();
    }
    catch (...)
    {
    }

    XalanDOMString xdsOutput( sbOutput.str() );
    return executionContext.getXObjectFactory().createString( xdsOutput );
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例7: PrefixResolverSetAndRestore

 PrefixResolverSetAndRestore(
         XPathExecutionContext&  theExecutionContext,
         const PrefixResolver*   theResolver) :
     m_executionContext(theExecutionContext),
     m_savedResolver(theExecutionContext.getPrefixResolver())
 {
     m_executionContext.setPrefixResolver(theResolver);
 }
开发者ID:apache,项目名称:xalan-c,代码行数:8,代码来源:XPathExecutionContext.hpp


示例8: assert

XObjectPtr
FunctionLang::execute(
            XPathExecutionContext&  executionContext,
            XalanNode*              context,
            const XObjectPtr        arg1,
            const LocatorType*      /* locator */) const
{
    assert(arg1.null() == false);   

    const XalanNode*        parent = context;

    bool                    fMatch = false;

    const XalanDOMString&   lang = arg1->str();

    while(0 != parent)
    {
        if(XalanNode::ELEMENT_NODE == parent->getNodeType())
        {
            const XalanElement* const   theElementNode =
#if defined(XALAN_OLD_STYLE_CASTS)
                (const XalanElement*)parent;
#else
                static_cast<const XalanElement*>(parent);
#endif

            const XalanDOMString&       langVal =
                theElementNode->getAttributeNS(
                    DOMServices::s_XMLNamespaceURI,
                    s_attributeName);

            if(0 != length(langVal))
            {
                XPathExecutionContext::GetAndReleaseCachedString theGuard1(executionContext);
                XPathExecutionContext::GetAndReleaseCachedString theGuard2(executionContext);

                if(startsWith(toLowerCaseASCII(langVal, theGuard1.get()), toLowerCaseASCII(lang, theGuard2.get())))
                {
                    const XalanDOMString::size_type     valLen = length(lang);

                    if(length(langVal) == valLen ||
                       charAt(langVal, valLen) == XalanUnicode::charHyphenMinus)
                    {
                        fMatch = true;

                        break;
                    }
                }
            }
        }

        parent = DOMServices::getParentOfNode(*parent);
    }

    return executionContext.getXObjectFactory().createBoolean(fMatch);
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:56,代码来源:FunctionLang.cpp


示例9: TestStringResults

void
TestStringResults(
            XPathFactory&           theXPathFactory,
            XPathProcessor&         theXPathProcessor,
            XPathEnvSupport&        theXPathEnvSupport,
            DOMSupport&             theDOMSupport,
            PrintWriter&            thePrintWriter,
            XPathExecutionContext&  theExecutionContext)
{
    assert(sizeof(theStringTestInput) == sizeof(theStringTestExpectedOutput));

    MemoryManagerType&      theMemoryManager =
        theExecutionContext.getMemoryManager();

    for(int i = 0; theStringTestInput[i] != 0; i++)
    {
        try
        {
            XPath* const    theXPath = theXPathFactory.create();

            XPathConstructionContextDefault     theXPathConstructionContext(theMemoryManager);

            const XPathGuard    theGuard(
                                    theXPathFactory,
                                    theXPath);

            XalanDOMString  theInputString(theMemoryManager);
            XalanDOMString  theResult(theMemoryManager);

            const ElementPrefixResolverProxy    thePrefixResolver(
                                                    0,
                                                    theXPathEnvSupport,
                                                    theDOMSupport);

            const NodeRefList   theDummyNodeList(theMemoryManager);

            TestStringResult(
                theXPathProcessor,
                *theXPath,
                theXPathConstructionContext,
                TranscodeFromLocalCodePage(theStringTestInput[i], theInputString),
                thePrintWriter,
                TranscodeFromLocalCodePage(theStringTestExpectedOutput[i], theResult),
                0,
                thePrefixResolver,
                theDummyNodeList,
                theExecutionContext);
        }
        catch(...)
        {
            thePrintWriter.print("Exception caught evaluating XPath \"");
            thePrintWriter.print(theStringTestInput[i]);
            thePrintWriter.println();
        }
    }
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:56,代码来源:TestXPath.cpp


示例10: 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);
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:43,代码来源:FunctionHasSameNodes.cpp


示例11: XALAN_USING_XALAN

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 ) );
}
开发者ID:FinTP,项目名称:fintp_base,代码行数:41,代码来源:ExtensionBase64.cpp


示例12: theGuard

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);
    }
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:40,代码来源:FunctionString.cpp


示例13: Hash

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() ) );
}
开发者ID:FinTP,项目名称:fintp_base,代码行数:39,代码来源:ExtensionHash.cpp


示例14: assert

XObjectPtr
FunctionStartsWith::execute(
            XPathExecutionContext&  executionContext,
            XalanNode*              /* context */,
            const XObjectPtr        arg1,
            const XObjectPtr        arg2,
            const Locator* const    /* locator */) const
{
    assert(arg1.null() == false && arg2.null() == false);   

    const bool  fStartsWith =
        startsWith(
            arg1->str(executionContext), 
            arg2->str(executionContext));

    return executionContext.getXObjectFactory().createBoolean(fStartsWith);
}
开发者ID:apache,项目名称:xalan-c,代码行数:17,代码来源:FunctionStartsWith.cpp


示例15: assert

XObjectPtr
FunctionString::execute(
            XPathExecutionContext&  executionContext,
            XalanNode*              /* context */,          
            const XObjectPtr        arg1,
            const LocatorType*      /* locator */) const
{
    assert(arg1.null() == false);   

    if (arg1->getType() == XObject::eTypeString)
    {
        // Since XObjects are reference counted, just return the
        // argument.
        return arg1;
    }
    else
    {
        return executionContext.getXObjectFactory().createStringAdapter(arg1);
    }
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:20,代码来源:FunctionString.cpp


示例16: theGuard

void
Function::generalError(
            XPathExecutionContext&  executionContext,
            const XalanNode*        context,
            const Locator*          locator) const
{
    const GetCachedString   theGuard(executionContext);

    XalanDOMString&     theErrorString = theGuard.get();

    executionContext.problem(
        XPathExecutionContext::eXPath,
        XPathExecutionContext::eError,
        getError(theErrorString),
        locator,
        context);

    throw XalanXPathException(
            theErrorString,
            theErrorString.getMemoryManager(),
            locator);
}
开发者ID:apache,项目名称:xalan-c,代码行数:22,代码来源:Function.cpp


示例17: catch

XALAN_CPP_NAMESPACE_BEGIN



XObjectPtr
XalanEXSLTFunctionEvaluate::execute(
			XPathExecutionContext&			executionContext,
			XalanNode*						context,
			const XObjectArgVectorType&		args,
			const LocatorType*				locator) const
{
	try
	{
		return ParentType::execute(executionContext, context, args, locator);
	}
	catch(const XSLException&)
	{
	}

	XPathExecutionContext::BorrowReturnMutableNodeRefList	theGuard(executionContext);

	return executionContext.getXObjectFactory().createNodeSet(theGuard);
}
开发者ID:,项目名称:,代码行数:23,代码来源:


示例18: assert

XObjectPtr
FunctionSample::execute(
            XPathExecutionContext&  executionContext,
            XalanNode*              /* context */,          
            const XObjectPtr        arg1,
            const XObjectPtr        arg2,
            const Locator*          /* locator */) const
{
   assert(arg1.null() == false);
   assert(arg2.null() == false);

   XalanDOMString path;
   arg1->str(path);
   const bool bLinux = arg2->boolean();

   XalanDOMChar dchOld;
   XalanDOMChar dchNew;

   if (bLinux)
   {
      dchOld = '\\';
      dchNew = '/';
   }
   else
   {
      dchOld = '/';
      dchOld = '\\';
   }

    int len = path.length();
   for (int i=0; i<len; i++)
      if (path[i] == dchOld)
         path[i] = dchNew;

    return executionContext.getXObjectFactory().createString(path); 
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:36,代码来源:XslFunctions.cpp


示例19: GetCachedNodeList

 GetCachedNodeList(XPathExecutionContext&    executionContext) :
     m_xpathExecutionContext(&executionContext),
     m_mutableNodeRefList(executionContext.borrowMutableNodeRefList())
 {
     assert(m_mutableNodeRefList != 0);
 }
开发者ID:apache,项目名称:xalan-c,代码行数:6,代码来源:XPathExecutionContext.hpp


示例20: TestAxisResult

bool
TestAxisResult(
            XPathProcessor&         theXPathProcessor,
            XPathEnvSupport&        theXPathEnvSupport,
            DOMSupport&             theDOMSupport,
            XMLParserLiaison&       theLiaison,
            XPathFactory&           theXPathFactory,
            const XalanDOMString&   theXMLFileURL,
            const XalanDOMString&   theXSLFileURL,
            PrintWriter&            thePrintWriter,
            XPathExecutionContext&  theExecutionContext)
{
    bool                    fError = false;

    XalanDocument* const    theXMLDocument = ParseXML(theLiaison,
                                                      theXMLFileURL);

    MemoryManagerType&      theMemoryManager =
        theExecutionContext.getMemoryManager();

    if (theXMLDocument != 0)
    {
        XalanDOMString      theContextNodeMatchPattern(theMemoryManager);
        XalanDOMString      theXPathString(theMemoryManager);

        if (GetXSLInput(theLiaison,
                        theXSLFileURL,
                        theContextNodeMatchPattern,
                        theXPathString,
                        theMemoryManager) == true)
        {
            XalanNode* const    theContextNode =
                FindContextNode(theXPathProcessor,
                                theXPathEnvSupport,
                                theDOMSupport,
                                theXPathFactory,
                                theXMLDocument,
                                theContextNodeMatchPattern,
                                thePrintWriter,
                                theExecutionContext);

            if (theContextNode != 0)
            {
                XalanElement* const             theNamespaceContext = 0;
                ElementPrefixResolverProxy      thePrefixResolver(theNamespaceContext, theXPathEnvSupport, theDOMSupport);
                NodeRefList                     theContextNodeList(theMemoryManager);

                XPath* const    theXPath = theXPathFactory.create();

                XPathConstructionContextDefault     theXPathConstructionContext(theMemoryManager);

                XPathGuard      theGuard(theXPathFactory,
                                         theXPath);

                theXPathProcessor.initXPath(*theXPath,
                                            theXPathConstructionContext,
                                            theXPathString,
                                            thePrefixResolver);

                bool    fDump = false;

                if (fDump == true)
                {
                    thePrintWriter.println();
                    thePrintWriter.println();
                    theXPath->getExpression().dumpOpCodeMap(thePrintWriter);
                    thePrintWriter.println();
                    theXPath->getExpression().dumpTokenQueue(thePrintWriter);
                    thePrintWriter.println();
                    thePrintWriter.println();
                }

                const XObjectPtr theResult =
                    theXPath->execute(theContextNode, thePrefixResolver, theContextNodeList, theExecutionContext);

                try
                {
                    assert(theResult.null() == false);

                    const NodeRefListBase&  theResultList =
                        theResult->nodeset();

                    const unsigned int  theLength = theResultList.getLength();

                    if (theLength == 0)
                    {
                        thePrintWriter.println("<out/>");
                    }
                    else
                    {
                        thePrintWriter.print("<out>");

                        for (unsigned int i = 0; i < theLength; i++)
                        {
                            thePrintWriter.print(theResultList.item(i)->getNodeName());
                            thePrintWriter.print(" ");
                        }

                        thePrintWriter.println("</out>");
                    }
//.........这里部分代码省略.........
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:101,代码来源:TestXPath.cpp



注:本文中的XPathExecutionContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XPathResult类代码示例发布时间:2022-05-31
下一篇:
C++ XPath类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap