dbertoni    2003/04/29 16:41:22

  Modified:    c/samples/SimpleXPathAPI SimpleXPathAPI.cpp
  Log:
  Updated sample to use XalanDocumentPrefixResolver.
  
  Revision  Changes    Path
  1.13      +6 -42     xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp
  
  Index: SimpleXPathAPI.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/SimpleXPathAPI/SimpleXPathAPI.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SimpleXPathAPI.cpp        23 Apr 2003 16:35:26 -0000      1.12
  +++ SimpleXPathAPI.cpp        29 Apr 2003 23:41:21 -0000      1.13
  @@ -19,8 +19,7 @@
   
   
   
  -#include <XalanDOM/XalanDocument.hpp>
  -#include <XalanDOM/XalanElement.hpp>
  +#include <DOMSupport/XalanDocumentPrefixResolver.hpp>
   
   
   
  @@ -35,44 +34,6 @@
   
   
   
  -XALAN_USING_XALAN(XalanNode)
  -XALAN_USING_XALAN(XalanElement)
  -
  -
  -
  -const XalanElement*
  -getPrefixResolver(const XalanNode*   node)
  -{
  -     if (node == 0)
  -     {
  -             return 0;
  -     }
  -     else if (node->getNodeType() == XalanNode::ELEMENT_NODE)
  -     {
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -             return (const XalanElement*)node;
  -#else
  -             return static_cast<const XalanElement*>(node);
  -#endif
  -     }
  -     else if (node->getNodeType() == XalanNode::DOCUMENT_NODE)
  -     {
  -             XALAN_USING_XALAN(XalanDocument)
  -
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -             return ((const XalanDocument*)node)->getDocumentElement();
  -#else
  -             return static_cast<const 
XalanDocument*>(node)->getDocumentElement();
  -#endif
  -     }
  -     else
  -     {
  -             return getPrefixResolver(node->getParentNode());
  -     }
  -}
  -
  -
  -
   int
   main(
                        int                             argc,
  @@ -107,6 +68,7 @@
                                XALAN_USING_XERCES(LocalFileInputSource)
   
                                XALAN_USING_XALAN(XalanDocument)
  +                             XALAN_USING_XALAN(XalanDocumentPrefixResolver)
                                XALAN_USING_XALAN(XalanDOMString)
                                XALAN_USING_XALAN(XalanNode)
                                XALAN_USING_XALAN(XalanSourceTreeInit)
  @@ -134,6 +96,8 @@
                                                
theLiaison.parseXMLStream(theInputSource);
                                assert(theDocument != 0);
   
  +                             XalanDocumentPrefixResolver             
thePrefixResolver(theDocument);
  +
                                XPathEvaluator  theEvaluator;
   
                                // OK, let's find the context node...
  @@ -142,7 +106,7 @@
                                                        theDOMSupport,
                                                        theDocument,
                                                        
XalanDOMString(argv[2]).c_str(),
  -                                                     
theDocument->getDocumentElement());
  +                                                     thePrefixResolver);
   
                                if (theContextNode == 0)
                                {
  @@ -162,7 +126,7 @@
                                                                theDOMSupport,
                                                                theContextNode,
                                                                
XalanDOMString(argv[3]).c_str(),
  -                                                             
getPrefixResolver(theContextNode)));
  +                                                             
thePrefixResolver));
   
                                        assert(theResult.null() == false);
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to