You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/04/27 16:47:49 UTC
cvs commit: xml-xalan/c/samples/XPathWrapper DLL.dsp TestDriver.cpp TestDriver.dsp XPathWrapper.cpp XPathWrapper.hpp
dbertoni 00/04/27 07:47:48
Modified: c/samples/XPathWrapper DLL.dsp TestDriver.cpp TestDriver.dsp
XPathWrapper.cpp XPathWrapper.hpp
Log:
Updated source files to work with Xalan code changes, changed project to build in standard build area, removed Windows-specific code, and added some basic sanity-checking.
Revision Changes Path
1.2 +8 -8 xml-xalan/c/samples/XPathWrapper/DLL.dsp
Index: DLL.dsp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/DLL.dsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DLL.dsp 1999/12/18 19:47:46 1.1
+++ DLL.dsp 2000/04/27 14:47:47 1.2
@@ -38,12 +38,12 @@
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\..\Build\Win32\VC6\Release"
+# PROP Intermediate_Dir "..\..\Build\Win32\VC6\Release\XPathWrapper"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLL_EXPORTS" /D "_XPathWrapper" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLL_EXPORTS" /D "_XPathWrapper" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -53,7 +53,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Release\xerces-c_1.lib ..\..\Build\Win32\VC6\Release\PlatformSupport.lib ..\..\Build\Win32\VC6\Release\XercesPlatformSupport.lib ..\..\Build\Win32\VC6\Release\XPath.lib ..\..\Build\Win32\VC6\Release\DOMSupport.lib ..\..\Build\Win32\VC6\Release\XercesParserLiaison.lib /nologo /dll /machine:I386
+# ADD LINK32 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Release\xerces-c_1.lib ..\..\Build\Win32\VC6\Release\PlatformSupport.lib ..\..\Build\Win32\VC6\Release\XercesPlatformSupport.lib ..\..\Build\Win32\VC6\Release\XPath.lib ..\..\Build\Win32\VC6\Release\DOMSupport.lib ..\..\Build\Win32\VC6\Release\XercesParserLiaison.lib /nologo /dll /machine:I386 /out:"..\..\Build\Win32\VC6\Release/XPathWrapper.dll"
!ELSEIF "$(CFG)" == "DLL - Win32 Debug"
@@ -64,12 +64,12 @@
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
+# PROP Output_Dir "..\..\Build\Win32\VC6\Debug"
+# PROP Intermediate_Dir "..\..\Build\Win32\VC6\Debug\XPathWrapper"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLL_EXPORTS" /D "_XPathWrapper" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "_WINDOWS" /D "_USRDLL" /D "DLL_EXPORTS" /D "_XPathWrapper" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "XML_DEBUG" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -79,7 +79,7 @@
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Debug\xerces-c_1.lib ..\..\Build\Win32\VC6\Debug\PlatformSupport.lib ..\..\Build\Win32\VC6\Debug\XercesPlatformSupport.lib ..\..\Build\Win32\VC6\Debug\XPath.lib ..\..\Build\Win32\VC6\Debug\DOMSupport.lib ..\..\Build\Win32\VC6\Debug\XercesParserLiaison.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\..\..\xml-xerces\c\Build\Win32\VC6\Debug\xerces-c_1.lib ..\..\Build\Win32\VC6\Debug\PlatformSupport.lib ..\..\Build\Win32\VC6\Debug\XercesPlatformSupport.lib ..\..\Build\Win32\VC6\Debug\XPath.lib ..\..\Build\Win32\VC6\Debug\DOMSupport.lib ..\..\Build\Win32\VC6\Debug\XercesParserLiaison.lib /nologo /dll /debug /machine:I386 /out:"..\..\Build\Win32\VC6\Debug/XPathWrapper.dll" /pdbtype:sept
!ENDIF
1.2 +39 -14 xml-xalan/c/samples/XPathWrapper/TestDriver.cpp
Index: TestDriver.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/TestDriver.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestDriver.cpp 1999/12/18 19:47:46 1.1
+++ TestDriver.cpp 2000/04/27 14:47:48 1.2
@@ -3,17 +3,36 @@
#include "XPathWrapper.hpp"
-int main(int argc, const char* argv[])
+
+
+class XMLException;
+
+
+
+int
+main(
+ int argc,
+ const char* argv[])
{
- if (argc<4)
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::cerr;
+ using std::cout;
+ using std::endl;
+ using std::ifstream;
+ using std::string;
+ using std::vector;
+#endif
+
+ if (argc < 4)
{
- std::cerr << "Syntax: TestDriver XMLFilePath Context XPathExpression\n";
+ cerr << "Usage: TestDriver XMLFilePath Context XPathExpression" << endl;
+
return -1;
}
- std::string theXML;
+ string theXML;
- std::ifstream in(argv[1]);
+ ifstream in(argv[1]);
// slow and dirty dump of the xml file into a buffer
char c;
@@ -24,18 +43,24 @@
// create your XPath helper object
XPathWrapper helper;
-
- // call evaluate, passing in the XML string, the context string and the xpath string
- std::vector<std::string> result = helper.evaluate(theXML, argv[2], argv[3]);
- // take the resulting string vector and do whatever you want with it:
- size_t len = result.size();
+ try
+ {
+ // call evaluate, passing in the XML string, the context string and the xpath string
+ const vector<string> result = helper.evaluate(theXML, argv[2], argv[3]);
- std::cout<< "the result set has " << len << " strings\n";
+ // take the resulting string vector and do whatever you want with it:
+ size_t len = result.size();
- for (size_t i=0; i<len; i++)
- std::cout<< "item " << (i+1) << "= \"" << result[i] << "\"" << std::endl;
+ cout<< "the result set has " << len << " strings\n";
+ for (size_t i=0; i<len; i++)
+ cout<< "item " << (i+1) << "= \"" << result[i] << "\"" << endl;
+ }
+ catch(const XMLException&)
+ {
+ cerr << "Exception caught! Exiting..." << endl;
+ }
return 0;
-}
\ No newline at end of file
+}
1.2 +5 -5 xml-xalan/c/samples/XPathWrapper/TestDriver.dsp
Index: TestDriver.dsp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/TestDriver.dsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestDriver.dsp 1999/12/18 19:47:46 1.1
+++ TestDriver.dsp 2000/04/27 14:47:48 1.2
@@ -37,8 +37,8 @@
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\..\Build\Win32\VC6\Release"
+# PROP Intermediate_Dir "..\..\Build\Win32\VC6\Release\XPathWrapper"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
@@ -61,12 +61,12 @@
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
+# PROP Output_Dir "..\..\Build\Win32\VC6\Debug"
+# PROP Intermediate_Dir "..\..\Build\Win32\VC6\Debug\XPathWrapper"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src" /D "_CONSOLE" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "XML_DEBUG" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
1.4 +133 -91 xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp
Index: XPathWrapper.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathWrapper.cpp 2000/01/26 14:42:54 1.3
+++ XPathWrapper.cpp 2000/04/27 14:47:48 1.4
@@ -3,16 +3,24 @@
#include <cassert>
#include <iostream>
+
+
+#include <framework/MemBufInputSource.hpp>
+#include <framework/URLInputSource.hpp>
#include <parsers/DOMParser.hpp>
#include <util/PlatformUtils.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOM_Element.hpp>
-#include <dom/DOM_NodeList.hpp>
-#include <framework/URLInputSource.hpp>
+
+
+
+#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanElement.hpp>
+
#include <PlatformSupport/DirectoryEnumerator.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
+#include <PlatformSupport/STLHelper.hpp>
+
#include <DOMSupport/DOMSupportDefault.hpp>
+
#include <XPath/XObjectFactoryDefault.hpp>
#include <XPath/XPathEnvSupportDefault.hpp>
#include <XPath/XPathExecutionContextDefault.hpp>
@@ -21,53 +29,54 @@
#include <XPath/XPathProcessorImpl.hpp>
#include <XPath/XPathFactoryDefault.hpp>
#include <XPath/ElementPrefixResolverProxy.hpp>
+
#include <XMLSupport/FormatterTreeWalker.hpp>
#include <XMLSupport/FormatterToXML.hpp>
-#include <XercesParserLiaison/XercesParserLiaison.hpp>
-#include <framework/MemBufInputSource.hpp>
+#include <XercesParserLiaison/XercesParserLiaison.hpp>
#include "XPathWrapper.hpp"
+#if !defined(XALAN_NO_NAMESPACES)
+using std::cerr;
+using std::endl;
+using std::string;
+using std::vector;
+#endif
+
+
+
////////////////////////////////////////////////////
// the implementation class, that does all calls to XPath and Xerces
class XPathWrapperImpl
{
-private:
- std::string DOMStringToStdString(const DOMString& domString)
- {
- std::string ret;
-
- for (int i=0; i< domString.length(); i++)
- {
- ret += (char)domString.charAt(i);
- }
-
- return ret;
- }
-
public:
- std::vector<std::string> evaluate(
- const std::string& xml,
- const std::string& context,
- const std::string& expr)
+
+ vector<string>
+ evaluate(
+ const string& xml,
+ const string& context,
+ const string& expr)
{
- //initialize XML4C
+ //initialize Xerces...
try
{
XMLPlatformUtils::Initialize();
}
-
- catch(const XMLException& e)
+ catch(const XMLException&)
{
+ cerr << "XMLPlatformUtils::Initialize() failed!" << endl;
+
throw;
}
// parse the XML file
- DOM_Element rootNode;
- DOMParser parser;
+ DOMSupportDefault theDOMSupport;
+ XercesParserLiaison theLiaison(theDOMSupport);
+
+ XalanElement* rootElem = 0;
try
{
@@ -75,99 +84,127 @@
MemBufInputSource inStream((const XMLByte*)xml.c_str(),
xml.length(), "foo", false);
- parser.parse(inStream);
+ XalanDocument* const doc = theLiaison.parseXMLStream(inStream);
+ assert(doc != 0);
- DOM_Document doc = parser.getDocument();
- rootNode = doc.getDocumentElement();
+ rootElem = doc->getDocumentElement();
+ assert(rootElem != 0);
}
-
- catch(const XMLException& e)
+ catch(const XMLException&)
{
+ cerr << "Caught XMLExecption..." << endl;
+
throw;
}
-
// configure the objects needed for XPath to work with the Xerces DOM
XPathEnvSupportDefault theEnvSupport;
- DOMSupportDefault theDOMSupport;
XPathSupportDefault theSupport(theDOMSupport);
XObjectFactoryDefault theXObjectFactory(theEnvSupport, theSupport);
XPathExecutionContextDefault theExecutionContext(theEnvSupport, theSupport, theXObjectFactory);
XPathFactoryDefault theXPathFactory;
XPathProcessorImpl theXPathProcessor;
- XercesParserLiaison theLiaison(theDOMSupport);
- std::vector<std::string> theResultList;
+ vector<string> theResultList;
try
{
// first get the context nodeset
- XPath *contextXPath = theXPathFactory.create();
+ XPath* const contextXPath = theXPathFactory.create();
theXPathProcessor.initXPath(*contextXPath,
- DOMString(context.c_str()),
- ElementPrefixResolverProxy(rootNode,theSupport),
+ XalanDOMString(context.c_str()),
+ ElementPrefixResolverProxy(rootElem, theEnvSupport, theSupport),
theXObjectFactory,
theEnvSupport);
- MutableNodeRefList contextNodeList; //default empty context
- XObject* xObj = contextXPath->execute(rootNode,
- ElementPrefixResolverProxy(rootNode,theSupport),
- contextNodeList,
- theExecutionContext);
-
- contextNodeList = xObj->mutableNodeset();
+ XObject* xObj =
+ contextXPath->execute(rootElem,
+ ElementPrefixResolverProxy(rootElem, theEnvSupport, theSupport),
+ theExecutionContext);
+ const NodeRefListBase& contextNodeList = xObj->mutableNodeset();
- // and now get the result of the primary xpath expression
- XPath *xpath = theXPathFactory.create();
- theXPathProcessor.initXPath(*xpath,
- DOMString(expr.c_str()),
- ElementPrefixResolverProxy(rootNode, theSupport),
- theXObjectFactory,
- theEnvSupport);
+ const unsigned int theLength =
+ contextNodeList.getLength();
- xObj = xpath->execute(rootNode,
- ElementPrefixResolverProxy(rootNode,theSupport),
- contextNodeList,
- theExecutionContext);
-
- // now encode the results. For all types but nodelist, we'll just convert it to a string
- // but, for nodelist, we'll convert each node to a string and return a list of them
- switch (xObj->getType())
+ if (theLength == 0)
{
- case XObject::eTypeNodeSet:
+ cerr << "Warning -- No nodes matched the location path \""
+ << context
+ << "\"."
+ << endl
+ << "Execution cannot continue..."
+ << endl
+ << endl;
+ }
+ else
+ {
+ if (theLength > 1)
{
- const NodeRefListBase& nodeset = xObj->nodeset();
- size_t len = nodeset.getLength();
+ cerr << "Warning -- More than one node matched the location path \""
+ << context
+ << "\"."
+ << endl
+ << "The first node matched will be used as the context node."
+ << endl
+ << endl;
+ }
- for (size_t i=0; i<len; i++)
+ // and now get the result of the primary xpath expression
+ XPath* const xpath = theXPathFactory.create();
+ theXPathProcessor.initXPath(*xpath,
+ XalanDOMString(expr.c_str()),
+ ElementPrefixResolverProxy(rootElem, theEnvSupport, theSupport),
+ theXObjectFactory,
+ theEnvSupport);
+
+ xObj = xpath->execute(contextNodeList.item(0),
+ ElementPrefixResolverProxy(rootElem, theEnvSupport, theSupport),
+ theExecutionContext);
+
+ // now encode the results. For all types but nodelist, we'll just convert it to a string
+ // but, for nodelist, we'll convert each node to a string and return a list of them
+ switch (xObj->getType())
+ {
+ case XObject::eTypeNodeSet:
{
- DOM_Node node = nodeset.item(i);
- DOMString str;
-
- const int theType = node.getNodeType();
-
- if (theType==DOM_Node::COMMENT_NODE || theType==DOM_Node::PROCESSING_INSTRUCTION_NODE)
- str = node.getNodeValue();
- else
- str = theSupport.getNodeData(node);
+ const NodeRefListBase& nodeset = xObj->nodeset();
+ size_t len = nodeset.getLength();
+
+ for (size_t i=0; i<len; i++)
+ {
+ XalanNode* const node = nodeset.item(i);
+ XalanDOMString str;
+
+ const int theType = node->getNodeType();
+
+ if (theType == XalanNode::COMMENT_NODE ||
+ theType == XalanNode::PROCESSING_INSTRUCTION_NODE)
+ str = node->getNodeValue();
+ else if (theType == XalanNode::ELEMENT_NODE)
+ str = node->getNodeName();
+ else
+ str = theSupport.getNodeData(*node);
- theResultList.push_back(DOMStringToStdString(str));
+ theResultList.push_back(DOMStringToStdString(str));
+ }
+
+ break;
}
- break;
- }
+ default:
+ {
+ theResultList.push_back(DOMStringToStdString(xObj->str()));
- default:
- {
- theResultList.push_back(DOMStringToStdString(xObj->str()));
- break;
+ break;
+ }
}
}
}
-
- catch(const XMLException& e)
+ catch(const XMLException&)
{
+ cerr << "Caught XMLExecption..." << endl;
+
throw;
}
@@ -180,20 +217,25 @@
// The public XPathWrapper methods just delegate to our impl class
-XPathWrapper::XPathWrapper()
+XPathWrapper::XPathWrapper() :
+ pImpl(new XPathWrapperImpl())
{
- pImpl = new XPathWrapperImpl();
}
+
+
XPathWrapper::~XPathWrapper()
{
delete pImpl;
}
+
+
-std::vector<std::string> XPathWrapper::evaluate(
- const std::string& xml,
- const std::string& context,
- const std::string& path)
+vector<string>
+XPathWrapper::evaluate(
+ const string& xml,
+ const string& context,
+ const string& path)
{
return pImpl->evaluate(xml,context,path);
}
1.2 +99 -11 xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp
Index: XPathWrapper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathWrapper.hpp 1999/12/18 19:47:46 1.1
+++ XPathWrapper.hpp 2000/04/27 14:47:48 1.2
@@ -1,37 +1,125 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.ibm.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+#if !defined(XPATH_WRAPPER_HEADER_GUARD_1357924680)
+#define XPATH_WRAPPER_HEADER_GUARD_1357924680
+
+
+
#include <string>
#include <vector>
+
+#include <Include/PlatformDefinitions.hpp>
+
+
+#if defined(_MSC_VER)
#ifdef _XPathWrapper
-#define XPathWrapperDecl __declspec(dllexport)
+#define XALAN_XPATHWRAPPER_EXPORT XALAN_PLATFORM_EXPORT
#else
-#define XPathWrapperDecl __declspec(dllimport)
+#define XALAN_XPATHWRAPPER_EXPORT XALAN_PLATFORM_IMPORT
+#endif
#endif
+
class XPathWrapperImpl;
+
-class XPathWrapperDecl XPathWrapper
+class XALAN_XPATHWRAPPER_EXPORT XPathWrapper
{
public:
+
XPathWrapper();
- virtual ~XPathWrapper();
+
+ virtual
+ ~XPathWrapper();
// Given an xml document and an xpath context and expression in the form of (ascii) string objects,
// this function parses the XML document, evaluates the xpath and returns the result, as a list of
// string objects
- std::vector<std::string> evaluate(
- const std::string& xml,
- const std::string& context,
- const std::string& path);
+#if defined(XALAN_NO_NAMESPACES)
+ vector<string>
+ evaluate(
+ const string& xml,
+ const string& context,
+ const string& path);
+#else
+ std::vector<std::string>
+ evaluate(
+ const std::string& xml,
+ const std::string& context,
+ const std::string& path);
+#endif
private:
+
// not implemented
XPathWrapper(const XPathWrapper&);
- XPathWrapper& operator=(const XPathWrapper&);
- bool operator==(const XPathWrapper&) const;
+
+ XPathWrapper&
+ operator=(const XPathWrapper&);
+
+ bool
+ operator==(const XPathWrapper&) const;
+
- XPathWrapperImpl* pImpl;
+ XPathWrapperImpl* const pImpl;
};
+#endif // XPATH_WRAPPER_HEADER_GUARD_1357924680