dbertoni    01/01/25 09:11:23

  Modified:    c/src/TestXPath TestXPath.cpp
  Log:
  Changes for new DirectoryEnumerator.
  
  Revision  Changes    Path
  1.29      +24 -15    xml-xalan/c/src/TestXPath/TestXPath.cpp
  
  Index: TestXPath.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/TestXPath/TestXPath.cpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- TestXPath.cpp     2001/01/08 18:16:08     1.28
  +++ TestXPath.cpp     2001/01/25 17:11:22     1.29
  @@ -324,7 +324,7 @@
                        XMLParserLiaison&               theLiaison,
                        const XalanDOMString&   theFileName)
   {
  -     URLInputSource  theURLInputSource(c_wstr(theFileName));
  +     const URLInputSource    theURLInputSource(c_wstr(theFileName));
   
        return theLiaison.parseXMLStream(theURLInputSource);
   }
  @@ -340,7 +340,7 @@
   
        if (theNode->getNodeType() == XalanNode::ELEMENT_NODE)
        {
  -             const XalanElement*             theElement =
  +             const XalanElement*     const   theElement =
   #if defined(XALAN_OLD_STYLE_CASTS)
                                        (const XalanElement*)theNode;
   #else
  @@ -441,18 +441,19 @@
                        PrintWriter&                    thePrintWriter,
                        XPathExecutionContext&  theExecutionContext)
   {
  -     XalanNode*                                                      
theResult = 0;
  +     XalanNode*              theResult = 0;
   
        XPath* const    theXPath = theXPathFactory.create();
   
  -     XPathGuard      theGuard(theXPathFactory,
  -                                              theXPath);
  +     XPathGuard              theGuard(
  +                                             theXPathFactory,
  +                                             theXPath);
   
        XalanElement*                           theNamespaceContext = 0;
        ElementPrefixResolverProxy      thePrefixResolver(theNamespaceContext, 
theXPathEnvSupport, theDOMSupport);
        NodeRefList                                     theContextNodeList;
   
  -     const XObjectPtr theXObject =
  +     const XObjectPtr        theXObject =
                ExecuteXPath(theXPathProcessor,
                                         *theXPath,
                                         theContextNodeMatchPattern,
  @@ -578,8 +579,12 @@
   
                                        const unsigned int      theLength = 
theResultList.getLength();
   
  -                                     if (theLength > 0)
  +                                     if (theLength == 0)
                                        {
  +                                             
thePrintWriter.println(XALAN_STATIC_UCODE_STRING("<out/>"));
  +                                     }
  +                                     else
  +                                     {
                                                
thePrintWriter.print(XALAN_STATIC_UCODE_STRING("<out>"));
   
                                                for (unsigned int i = 0; i < 
theLength; i++)
  @@ -587,9 +592,9 @@
                                                        
thePrintWriter.print(theResultList.item(i)->getNodeName());
                                                        
thePrintWriter.print(XALAN_STATIC_UCODE_STRING(" "));
                                                }
  -                                     }
   
  -                                     
thePrintWriter.println(XALAN_STATIC_UCODE_STRING("</out>"));
  +                                             
thePrintWriter.println(XALAN_STATIC_UCODE_STRING("</out>"));
  +                                     }
                                }
                                catch(...)
                                {
  @@ -1168,10 +1173,14 @@
                        PrintWriter&                    thePrintWriter,
                        XPathExecutionContext&  theExecutionContext)
   {
  -     const XalanDOMString            
theProtocol(XALAN_STATIC_UCODE_STRING("file://"));
  -     const XalanDOMString            theBaseURL = theProtocol + theDirectory;
  -     const XalanDOMString            theSearchSpecification(theDirectory);
  -     const XalanDOMString            
theXMLSuffix(XALAN_STATIC_UCODE_STRING(".xml"));
  +     const XalanDOMString    
theProtocol(XALAN_STATIC_UCODE_STRING("file://"));
  +     const XalanDOMString    theBaseURL = theProtocol + theDirectory;
  +#if defined(WIN32)
  +     const XalanDOMString    theSearchSpecification(theDirectory + "\\*");
  +#else
  +     const XalanDOMString    theSearchSpecification(theDirectory + "/*");
  +#endif
  +     const XalanDOMString    theXMLSuffix(XALAN_STATIC_UCODE_STRING(".xml"));
   
   #if defined(XALAN_NO_NAMESPACES)
        typedef vector<XalanDOMString>          FileNameVectorType;
  @@ -1195,10 +1204,10 @@
                        try
                        {
                                // Create a fully qualified URL specification...
  -                             const XalanDOMString            theXMLFileName 
= theBaseURL + theFiles[i];
  +                             const XalanDOMString    theXMLFileName = 
theBaseURL + theFiles[i];
   
                                // Get the name of the corresponding XSL file...
  -                             const XalanDOMString            theXSLFileName 
= GetXSLFileName(theXMLFileName);
  +                             const XalanDOMString    theXSLFileName = 
GetXSLFileName(theXMLFileName);
   
                                XPathGuard      theXPath(theXPathFactory,
                                                                         
theXPathFactory.create());
  
  
  

Reply via email to