本文整理汇总了C++中XObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ XObjectPtr类的具体用法?C++ XObjectPtr怎么用?C++ XObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XObjectPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
XObjectPtr
FunctionFormatNumber::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* locator) const
{
assert(arg1.null() == false && arg2.null() == false);
const double theNumber = arg1->num();
const XalanDOMString& thePattern = arg2->str();
typedef XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
GetAndReleaseCachedString theString(executionContext);
executionContext.formatNumber(
theNumber,
thePattern,
theString.get(),
context,
locator);
return executionContext.getXObjectFactory().createString(theString);
}
开发者ID:,项目名称:,代码行数:26,代码来源:
示例2: getTotal
/*
* Get the total of the second and third arguments.
*/
inline double
getTotal(
XalanDOMString::size_type theSourceStringLength,
double theSecondArgValue,
const XObjectPtr& arg3)
{
// Total the second and third arguments. If the third argument is
// missing, make it the length of the string + 1 (for XPath
// indexing style).
if (arg3.null() == true)
{
return double(theSourceStringLength + 1);
}
else
{
const double theRoundedValue =
DoubleSupport::round(DoubleSupport::add(theSecondArgValue, arg3->num()));
// If there's overflow, then we should return the length of the string + 1.
if (DoubleSupport::isPositiveInfinity(theRoundedValue) == true)
{
return double(theSourceStringLength + 1);
}
else
{
return theRoundedValue;
}
}
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例3: 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,代码来源:
示例4: 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
示例5: assert
XObjectPtr
FunctionSubstring::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* locator) const
{
assert(arg1.null() == false && arg2.null() == false);
return execute(executionContext, context, arg1, arg2, s_nullXObjectPtr, locator);
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例6: 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
示例7: createEmptyString
XObjectPtr
FunctionSubstringBefore::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2,
const LocatorType* /* locator */) const
{
assert(arg1.null() == false && arg2.null() == false);
const XalanDOMString& theFirstString = arg1->str();
const XalanDOMString::size_type theFirstStringLength = length(theFirstString);
if (theFirstStringLength == 0)
{
return createEmptyString(executionContext);
}
else
{
const XalanDOMString& theSecondString = arg2->str();
const XalanDOMString::size_type theSecondStringLength = length(theSecondString);
if (theSecondStringLength == 0)
{
return createEmptyString(executionContext);
}
else
{
const XalanDOMString::size_type theIndex = indexOf(theFirstString,
theSecondString);
if (theIndex == theFirstStringLength)
{
return createEmptyString(executionContext);
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theResult(executionContext);
XalanDOMString& theString = theResult.get();
theString.assign(
toCharArray(theFirstString),
theIndex);
// Create a string of the appropriate length...
return executionContext.getXObjectFactory().createString(theResult);
}
}
}
}
开发者ID:,项目名称:,代码行数:53,代码来源:
示例8: TestStringResult
bool
TestStringResult(
XPathProcessor& theXPathProcessor,
XPath& theXPath,
XPathConstructionContext& theXPathConstructionContext,
const XalanDOMString& theXPathString,
PrintWriter& thePrintWriter,
const XalanDOMString& theExpectedResult,
XalanNode* theContextNode,
const PrefixResolver& thePrefixResolver,
const NodeRefListBase& theContextNodeList,
XPathExecutionContext& theExecutionContext)
{
bool fError = false;
const XObjectPtr theResult =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
theXPath,
theXPathString,
theContextNode,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
thePrintWriter.print("Execution of XPath ");
thePrintWriter.print(theXPathString);
if (equals(theResult->str(), theExpectedResult) == true)
{
thePrintWriter.println(" succeeded.");
thePrintWriter.print("The result was \"");
thePrintWriter.print(theResult->str());
thePrintWriter.println("\".");
}
else
{
fError = true;
thePrintWriter.println(" failed!");
thePrintWriter.print("The expected result was \"");
thePrintWriter.print(theExpectedResult);
thePrintWriter.println("\".");
thePrintWriter.print("The actual result was \"");
thePrintWriter.print(theResult->str());
thePrintWriter.println("\".");
}
return fError;
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:51,代码来源:TestXPath.cpp
示例9: 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
示例10: 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
示例11: 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
示例12: XalanDocumentFragmentXNodeSetBaseProxy
XalanDocumentFragmentXNodeSetBaseProxy(const XObjectPtr& theXObject) :
XNodeSetBase(),
m_xobject(theXObject),
m_proxy(theXObject->rtree())
{
}
开发者ID:,项目名称:,代码行数:6,代码来源:
示例13: TestBooleanResult
bool
TestBooleanResult(
XPathProcessor& theXPathProcessor,
XPath& theXPath,
XPathConstructionContext& theXPathConstructionContext,
const XalanDOMString& theXPathString,
PrintWriter& thePrintWriter,
bool theExpectedResult,
XalanNode* theContextNode,
const PrefixResolver& thePrefixResolver,
const NodeRefListBase& theContextNodeList,
XPathExecutionContext& theExecutionContext)
{
bool fError = false;
const XObjectPtr theResult =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
theXPath,
theXPathString,
theContextNode,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
bool fDump = false;
if (fDump == true)
{
thePrintWriter.println();
thePrintWriter.println();
theXPath.getExpression().dumpOpCodeMap(thePrintWriter);
thePrintWriter.println();
theXPath.getExpression().dumpTokenQueue(thePrintWriter);
thePrintWriter.println();
thePrintWriter.println();
}
thePrintWriter.print("Execution of XPath ");
thePrintWriter.print(theXPathString);
if (theResult->boolean() == theExpectedResult)
{
thePrintWriter.println(" succeeded.");
thePrintWriter.print("The result was ");
thePrintWriter.print(theResult->boolean());
thePrintWriter.println(".");
}
else
{
fError = true;
thePrintWriter.println(" failed!");
thePrintWriter.print("The expected result was \"");
thePrintWriter.print(theExpectedResult);
thePrintWriter.println("\".");
thePrintWriter.print("The actual result was \"");
thePrintWriter.print(theResult->boolean());
thePrintWriter.println("\".");
}
return fError;
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:64,代码来源:TestXPath.cpp
示例14: FindContextNode
XalanNode*
FindContextNode(
XPathProcessor& theXPathProcessor,
XPathEnvSupport& theXPathEnvSupport,
DOMSupport& theDOMSupport,
XPathFactory& theXPathFactory,
XalanDocument* theDocument,
const XalanDOMString& theContextNodeMatchPattern,
PrintWriter& thePrintWriter,
XPathExecutionContext& theExecutionContext)
{
XalanNode* theResult = 0;
MemoryManagerType& theMemoryManager =
theExecutionContext.getMemoryManager();
XPath* const theXPath = theXPathFactory.create();
XPathConstructionContextDefault theXPathConstructionContext;
XPathGuard theGuard(
theXPathFactory,
theXPath);
XalanElement* theNamespaceContext = 0;
ElementPrefixResolverProxy thePrefixResolver(theNamespaceContext, theXPathEnvSupport, theDOMSupport);
NodeRefList theContextNodeList(theMemoryManager);
const XObjectPtr theXObject =
ExecuteXPath(
theXPathProcessor,
theXPathConstructionContext,
*theXPath,
theContextNodeMatchPattern,
theDocument,
thePrefixResolver,
theContextNodeList,
theExecutionContext);
try
{
assert(theXObject.null() == false);
const NodeRefListBase& theResultList =
theXObject->nodeset();
if (theResultList.getLength() == 0)
{
thePrintWriter.print("FindContextNode: Unable to find context node using select \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
thePrintWriter.println("FindContextNode: No nodes matched the pattern.");
}
else if (theResultList.getLength() != 1)
{
thePrintWriter.print("FindContextNode: Unable to find context node using select \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
thePrintWriter.println("FindContextNode: More than one node matched the pattern.");
}
else
{
theResult = theResultList.item(0);
}
}
catch(...)
{
thePrintWriter.print("FindContextNode: Error executing match pattern \"");
thePrintWriter.print(theContextNodeMatchPattern);
thePrintWriter.println("\".");
}
return theResult;
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:74,代码来源:TestXPath.cpp
示例15: display
void display()
{
try
{
Render::start();
Render::LIGHT->on();
static double t = 0.0;
t += 0.03333;
GLfloat amb[4] = {0.25f, 0.20f, 0.07f, 1.f};
GLfloat dif[4] = {0.75f, 0.61f, 0.23f, 1.f};
GLfloat spe[4] = {0.63f, 0.56f, 0.37f, 1.f};
GLfloat shine = 51.2f;
glTranslated(0.0, 1.0, 0.0);
glRotated(90.0, 1.0, 0.0, 0.0);
Material::setMaterial(amb, dif, spe, shine);
glutSolidTeapot(0.1);
std::string path = "/home/daichi/Work/catkin_ws/src/ahl_ros_pkgs/ahl_common/wrapper/gl_wrapper/blender/";
static XObjectPtr lwr1 = XObjectPtr(new XObject(path + "lwr07.x"));
static XObjectPtr lwr2 = XObjectPtr(new XObject(path + "lwr07.x"));
static XObjectPtr lwr3 = XObjectPtr(new XObject(path + "lwr07.x"));
static SimpleObjectPtr grid = SimpleObjectPtr(new Grid(20, 20, 0.5));
lwr1->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr1->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr1->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr1->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr1->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr2->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr2->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr2->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr2->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link01"), M_PI * std::sin(2.0 * M_PI * 0.1 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link02"), 0.0, 0.35 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr3->setEulerZYX(std::string("Link03"), 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link04"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.2 * t), 0.0);
lwr3->setEulerZYX(std::string("Link05"), 0.4 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0, 0.0);
lwr3->setEulerZYX(std::string("Link06"), 0.0, 0.5 * M_PI * std::sin(2.0 * M_PI * 0.3 * t), 0.0);
lwr3->setEulerZYX(std::string("EndEffector"), M_PI * std::sin(2.0 * M_PI * 0.6 * t), 0.0, 0.0);
glLoadIdentity();
lwr1->display();
glLoadIdentity();
glTranslated(0.0, -0.6, 0.0);
lwr2->display();
glLoadIdentity();
glTranslated(0.0, -1.2, 0.0);
lwr3->display();
glLoadIdentity();
grid->setColor(0, 0, 255);
grid->setPosition(0.0, 0.0, 0.0);
grid->display();
/*
gl_wrapper::RightHandPtr right_hand;
right_hand = RightHandPtr(new RightHand("/home/daichi/work/catkin_ws/src/gl_wrapper/righthand.cfg"));
right_hand->display();
*/
Render::end();
}
catch(Exception& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(FatalException& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(std::exception& e)
{
ROS_ERROR_STREAM(e.what());
exit(1);
}
catch(...)
{
ROS_ERROR_STREAM("display : Unknown exception was thrown.");
exit(1);
}
}
开发者ID:daichi-yoshikawa,项目名称:ahl_common,代码行数:94,代码来源:test.cpp
示例16: 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
示例17: TestPredicateResult
bool
TestPredicateResult(
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 theXPath1 = theXPathFactory.create();
XPathConstructionContextDefault theXPathConstructionContext(theMemoryManager);
XPathGuard theGuard1(theXPathFactory,
theXPath1);
XalanDOMString theResult(theMemoryManager);
theXPathProcessor.initXPath(*theXPath1,
theXPathConstructionContext,
TranscodeFromLocalCodePage("following-sibling::*", theResult),
thePrefixResolver);
XPath* const theXPath2 = theXPathFactory.create();
XPathGuard theGuard2(theXPathFactory,
theXPath2);
theXPathProcessor.initXPath(*theXPath2,
theXPathConstructionContext,
TranscodeFromLocalCodePage("descendant::*", theResult),
thePrefixResolver);
bool fDump = false;
if (fDump == true)
{
thePrintWriter.println();
thePrintWriter.println();
theXPath1->getExpression().dumpOpCodeMap(thePrintWriter);
thePrintWriter.println();
theXPath1->getExpression().dumpTokenQueue(thePrintWriter);
thePrintWriter.println();
thePrintWriter.println();
theXPath2->getExpression().dumpOpCodeMap(thePrintWriter);
thePrintWriter.println();
theXPath2->getExpression().dumpTokenQueue(thePrintWriter);
thePrintWriter.println();
thePrintWriter.println();
}
XalanNode* theContextNode = theXMLDocument->getFirstChild()->getFirstChild();
for( ; theContextNode != 0; theContextNode = theContextNode->getNextSibling())
{
if (theContextNode->getNodeType() != XalanNode::ELEMENT_NODE)
{
continue;
}
const XObjectPtr theResult1 =
//.........这里部分代码省略.........
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:101,代码来源:TestXPath.cpp
示例18: setXPathNS
//.........这里部分代码省略.........
int offset = 0;
safeBuffer k(KLUDGE_PREFIX);
k.sbStrcatIn(":");
// Map the expression into a local code page string (silly - should be XMLCh)
safeBuffer exprSB;
exprSB << (*mp_formatter << expr->m_expr.rawXMLChBuffer());
offset = exprSB.sbStrstr("here()");
while (offset >= 0) {
if (offset == 0 || offset == 1 ||
(!(exprSB[offset - 1] == ':' && exprSB[offset - 2] != ':') &&
separator(exprSB[offset - 1]))) {
exprSB.sbStrinsIn(k.rawCharBuffer(), offset);
}
offset = exprSB.sbOffsetStrstr("here()", offset + 11);
}
// Install the External function in the Environment handler
if (hereNode != NULL) {
xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
}
XPath * xp = xpf.create();
XalanDOMString Xexpr((char *) exprSB.rawBuffer());
xppi.initXPath(*xp, xpcc, Xexpr, pr);
// Now resolve
XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
// Now map to a list that others can use (naieve list at this time)
const NodeRefListBase& lst = xObj->nodeset();
int size = (int) lst.getLength();
const DOMNode *item;
XSECXPathNodeList * ret;
XSECnew(ret, XSECXPathNodeList);
Janitor<XSECXPathNodeList> j_ret(ret);
for (int i = 0; i < size; ++ i) {
if (lst.item(i) == xd)
ret->addNode(document);
else {
item = xwn.mapNode(lst.item(i));
ret->addNode(item);
}
}
xpesd.uninstallExternalFunctionGlobal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"));
clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
j_ret.release();
return ret;
}
catch (XSLException &e) {
safeBuffer msg;
// Whatever happens - fix any changes to the original document
clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
// Collate the exception message into an XSEC message.
msg.sbTranscodeIn("Xalan Exception : ");
#if defined (XSEC_XSLEXCEPTION_RETURNS_DOMSTRING)
msg.sbXMLChCat(e.getType().c_str());
#else
msg.sbXMLChCat(e.getType());
#endif
msg.sbXMLChCat(" caught. Message : ");
msg.sbXMLChCat(e.getMessage().c_str());
throw XSECException(XSECException::XPathFilterError,
msg.rawXMLChBuffer());
}
catch (...) {
clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
throw;
}
return NULL;
}
开发者ID:okean,项目名称:cpputils,代码行数:101,代码来源:TXFMXPathFilter.cpp
示例19: setXPathNS
//.........这里部分代码省略.........
XPathEnvSupportDefault xpesd;
XObjectFactoryDefault xof;
XPathExecutionContextDefault xpec(xpesd, xds, xof);
ElementPrefixResolverProxy pr(xd->getDocumentElement(), xpesd, xds);
// Work around the fact that the XPath implementation is designed for XSLT, so does
// not allow here() as a NCName.
// THIS IS A KLUDGE AND SHOULD BE DONE BETTER
int offset = 0;
safeBuffer k(KLUDGE_PREFIX);
k.sbStrcatIn(":");
offset = inexpr.sbStrstr("here()");
while (offset >= 0) {
if (offset == 0 || offset == 1 ||
(!(inexpr[offset - 1] == ':' && inexpr[offset - 2] != ':') &&
separator(inexpr[offset - 1]))) {
inexpr.sbStrinsIn(k.rawCharBuffer(), offset);
}
offset = inexpr.sbOffsetStrstr("here()", offset + 11);
}
// Install the External function in the Environment handler
if (hereNode != NULL) {
xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
}
str.sbStrcpyIn("(descendant-or-self::node() | descendant-or-self::node()/attribute::* | descendant-or-self::node()/namespace::*)[");
str.sbStrcatIn(inexpr);
str.sbStrcatIn("]");
XPath * xp = xpf.create();
XalanDOMString Xexpr((char *) str.rawBuffer());
xppi.initXPath(*xp, xpcc, Xexpr, pr);
// Now resolve
XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
// Now map to a list that others can use (naieve list at this time)
const NodeRefListBase& lst = xObj->nodeset();
int size = (int) lst.getLength();
const DOMNode *item;
for (int i = 0; i < size; ++ i) {
if (lst.item(i) == xd)
m_XPathMap.addNode(document);
else {
item = xwn.mapNode(lst.item(i));
m_XPathMap.addNode(item);
}
}
if (inputType == DOM_NODE_XPATH_NODESET) {
//the input list was a XPATH nodeset, so we must intersect the
// results of the XPath processing done above with the input nodeset
m_XPathMap.intersect(input->getXPathNodeList());
}
}
catch (XSLException &e) {
safeBuffer msg;
// Whatever happens - fix any changes to the original document
clearXPathNS(document, addedNodes, formatter, mp_nse);
// Collate the exception message into an XSEC message.
msg.sbTranscodeIn("Xalan Exception : ");
#if defined (XSEC_XSLEXCEPTION_RETURNS_DOMSTRING)
msg.sbXMLChCat(e.getType().c_str());
#else
msg.sbXMLChCat(e.getType());
#endif
msg.sbXMLChCat(" caught. Message : ");
msg.sbXMLChCat(e.getMessage().c_str());
throw XSECException(XSECException::XPathError,
msg.rawXMLChBuffer());
}
clearXPathNS(document, addedNodes, formatter, mp_nse);
}
开发者ID:okean,项目名称:cpputils,代码行数:101,代码来源:TXFMXPath.cpp
示例20: findEntry
const XObjectPtr
VariablesStack::findXObject(
const XalanQName& name,
StylesheetExecutionContext& executionContext,
bool fIsParam,
bool fSearchGlobalSpace,
bool& fNameFound)
{
typedef VariableStackStackType::size_type size_type;
// findEntry() returns an index into the stack. We should
// _never_ take the address of anything in the stack, since
// the address could change at unexpected times.
const size_type theEntryIndex =
findEntry(name, fIsParam, fSearchGlobalSpace);
if (theEntryIndex == m_stack.size())
{
fNameFound = false;
return XObjectPtr();
}
else
{
assert(theEntryIndex < m_stack.size());
fNameFound = true;
assert(m_stack[theEntryIndex].getType() == StackEntry::eVariable ||
m_stack[theEntryIndex].getType() == StackEntry::eParam ||
m_stack[theEntryIndex].getType() == StackEntry::eActiveParam);
const XObjectPtr& theValue = m_stack[theEntryIndex].getValue();
if (theValue.null() == false)
{
return theValue;
}
else
{
const ElemVariable* const var = m_stack[theEntryIndex].getVariable();
XObjectPtr theNewValue;
if (var != 0)
{
XalanNode* const doc = executionContext.getRootDocument();
assert(doc != 0);
XALAN_USING_STD(find)
// See if the ElemVariable instance is already being evaluated...
if (find(m_guardStack.begin(), m_guardStack.end(), var) != m_guardStack.end())
{
const StylesheetExecutionContext::GetCachedString theGuard(executionContext);
executionContext.error(
XalanMessageLoader::getMessage(
theGuard.get(),
XalanMessages::CircularVariableDefWasDetected),
doc,
var->getLocator());
}
m_guardStack.push_back(var);
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
executionContext.pushContextMarker();
#else
// We need to set up a stack frame for the variable's execution...
typedef StylesheetExecutionContext::PushAndPopContextMarker PushAndPopContextMarker;
const PushAndPopContextMarker theContextMarkerPushPop(executionContext);
#endif
theNewValue = var->getValue(executionContext, doc);
assert(theNewValue.null() == false);
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
executionContext.popContextMarker();
#endif
assert(m_guardStack.empty() == false);
m_guardStack.pop_back();
m_stack[theEntryIndex].setValue(theNewValue);
m_stack[theEntryIndex].activate();
}
return theNewValue;
}
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:93,代码来源:VariablesStack.cpp
注:本文中的XObjectPtr类示例由纯净天空整理自Github/MSDocs等源码及文 |
请发表评论