pauldick    01/07/11 13:22:00

  Modified:    c/Tests/Compare compare.cpp
  Log:
  File cleaned up. All references to domCompare removed. They are
  now in FileUtility.cpp within the Harness.
  
  Revision  Changes    Path
  1.4       +2 -323    xml-xalan/c/Tests/Compare/compare.cpp
  
  Index: compare.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Tests/Compare/compare.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- compare.cpp       2001/07/11 17:48:51     1.3
  +++ compare.cpp       2001/07/11 20:21:50     1.4
  @@ -110,25 +110,7 @@
   #if !defined(NDEBUG) && defined(_MSC_VER)
   #include <crtdbg.h>
   #endif
  -/*
  -char *xalanNodeTypes[]=
  -     {"UNKNOWN_NODE",
  -     "ELEMENT_NODE",
  -     "ATTRIBUTE_NODE",
  -     "TEXT_NODE",
  -     "CDATA_SECTION_NODE",
  -     "ENTITY_REFERENCE_NODE",
  -     "ENTITY_NODE",
  -     "PROCESSING_INSTRUCTION_NODE",
  -     "COMMENT_NODE",
  -     "DOCUMENT_NODE",
  -     "DOCUMENT_TYPE_NODE",
  -     "DOCUMENT_FRAGMENT_NODE",
  -     "NOTATION_NODE"};
  -
  -bool 
  -domCompare(const XalanNode& gold ,const XalanNode& doc, XalanDOMString 
fileName);
  -*/
  +
   void
   printArgOptions()
   {
  @@ -264,311 +246,7 @@
        return fSuccess;
   }
   
  -/*
  -void
  -reportError( XalanDOMString file, XalanDOMString node, char* msg)
  -{
  -
  -     cout << endl << "Failed "<< file << endl
  -              << "   Processing node : " << node << endl
  -              << "   " << msg ;
  -}
  -
  -
  -
  -bool diffATTR(const XalanNode* gAttr, const XalanNode* dAttr, const 
XalanDOMString& fileName)
  -{
  -
  -     const XalanDOMString& goldAttrName = gAttr->getNodeName();
  -     const XalanDOMString& docAttrName  = dAttr->getNodeName();
  -
  -
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     cout << "       Attribute is: " << 
c_str(TranscodeToLocalCodePage(goldAttrName)) << endl;
  -#endif
  -
  -     const XalanDOMString& goldAttrNsUri = gAttr->getNamespaceURI();
  -     const XalanDOMString& docAttrNsUri      = dAttr->getNamespaceURI();
  -
  -     //const XalanDOMString& goldAttrPrefix = gAttr->getPrefix();
  -     //const XalanDOMString& docAttrPrefix = dAttr->getPrefix();
  -
  -     //const XalanDOMString& goldAttrLName = gAttr->getLocalName();
  -     //const XalanDOMString& docAttrLName = dAttr->getLocalName();
  -     
  -     const XalanDOMString& goldAttrValue = gAttr->getNodeValue();
  -     const XalanDOMString& docAttrValue      = dAttr->getNodeValue();
  -
  -     if (goldAttrValue != docAttrValue)
  -     {
  -             reportError(fileName, docAttrName, "Error: Attribute Value 
mismatch. Expected: ");
  -             cout << c_str(TranscodeToLocalCodePage(goldAttrValue));         
                                        
  -             return false;
  -     }
  -
  -     if (goldAttrNsUri != docAttrNsUri)
  -     {
  -             reportError(fileName, docAttrName, "Error: Attribute 
NamespaceURI mismatch. Expected: ");
  -             cout << c_str(TranscodeToLocalCodePage(goldAttrNsUri));         
                                        
  -             return false;
  -     }
  -
  -//   I think that these are not necessary. I assume that they will be caught 
earlier when
  -//   checking for named attributes.
  -
  -//   if (goldAttrPrefix != docAttrPrefix)
  -//   {
  -//           reportError(fileName, "Error: Attribute Namespace Prefix 
mismatch. Expected: ",errAttrName);
  -//           cout << c_str(TranscodeToLocalCodePage(goldAttrPrefix));        
                                                
  -//           return false;
  -//   }
  -
  -//   if (goldAttrLName != docAttrLName)
  -//   {
  -//           reportError(fileName, "Error: Attribute LocalName mismatch. 
Expected: ",errAttrName);
  -//           cout << c_str(TranscodeToLocalCodePage(goldAttrLName));         
                                        
  -//           return false;
  -//   }
  -
  -     return true;
  -}
  -
  -bool
  -diffElement(const XalanNode& gold, const XalanNode& doc, const 
XalanDOMString& fileName)
  -{
  -     const XalanDOMString&  docNodeName  = doc.getNodeName();        
  -     const XalanDOMString&  goldNodeName = gold.getNodeName();
  -
  -     const XalanDOMString&  docNsUri  = doc.getNamespaceURI();
  -     const XalanDOMString&  goldNsUri = gold.getNamespaceURI();
   
  -     //const XalanDOMString&  docPrefix = doc.getPrefix();
  -     //const XalanDOMString&  goldPrefix = gold.getPrefix();
  -
  -     //const XalanDOMString& docLName = doc.getLocalName();
  -     //const XalanDOMString& goldLName = gold.getLocalName();
  -
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -     cout << "Node is: " << c_str(TranscodeToLocalCodePage(docNodeName)) << 
endl;
  -#endif
  -
  -     // This essentially checks 2 things, that the prefix and localname are 
the
  -     // same.  So specific checks of these items are not necessary.
  -     if (goldNodeName != docNodeName)
  -     {
  -             reportError(fileName, docNodeName, "Error: Element mismatch. 
Expected: ");
  -             cout << c_str(TranscodeToLocalCodePage(goldNodeName));          
  -             return false;
  -     }
  -
  -     if ( goldNsUri != docNsUri)
  -     {
  -             reportError(fileName, docNodeName, "Error: Element NamespaceURI 
mismatch. Expected: ");
  -             cout << c_str(TranscodeToLocalCodePage(goldNsUri));
  -             return false;
  -     }
  -
  -     if ( goldNsUri != docNsUri)
  -     {
  -             reportError(fileName, docNodeName, "Error: Element NamespaceURI 
mismatch. Expected: ");
  -             cout << c_str(TranscodeToLocalCodePage(goldNsUri));
  -             return false;
  -     }
  -
  -
  -     // Get Attributes for each Element Node. 
  -     const XalanNamedNodeMap *goldAttrs = gold.getAttributes();
  -     const XalanNamedNodeMap *docAttrs  = doc.getAttributes();
  -     
  -     // Get number of Attributes
  -     int numGoldAttr = goldAttrs->getLength();
  -     int numDomAttr  = docAttrs ->getLength();
  -
  -     // Check that each Element has same number of Attributes. If they don't 
report error 
  -     if ( numGoldAttr == numDomAttr )
  -     {
  -             // Compare Attributes one at a time.
  -             for (int i=0; i < numGoldAttr; i++)
  -             {
  -                     // Attribute order is irrelvant, so comparision is base 
on Attribute name.
  -                     XalanNode *gAttr = goldAttrs->item(i);
  -                     XalanDOMString goldAttrName = gAttr->getNodeName();
  -
  -                     XalanNode *dAttr = docAttrs->getNamedItem(goldAttrName);
  -                     if (dAttr != 0)
  -                     {
  -                             if( ! (diffATTR(gAttr, dAttr, fileName)) )
  -                                     return false;
  -                     }
  -                     else
  -                     {
  -                             reportError(fileName, docNodeName, "Error: 
Element missing named Attribute. Expected: ");
  -                             cout << 
c_str(TranscodeToLocalCodePage(goldAttrName));
  -                             return false;
  -                     }
  -             }
  -     }
  -     else
  -     {
  -             reportError( fileName, docNodeName, "Error: Elements don't have 
same number of attributes. Expected: ");
  -             cout << numGoldAttr;;
  -             return false;
  -     }
  -
  -     const XalanNode *goldNextNode;
  -     const XalanNode *domNextNode;
  -
  -     goldNextNode = gold.getFirstChild();
  -     domNextNode = doc.getFirstChild();
  -
  -     if (0 != goldNextNode )
  -     {
  -             if (0 != domNextNode)
  -             {
  -                     if ( ! domCompare(*goldNextNode, *domNextNode, 
fileName) )
  -                             return false;
  -             }
  -             else
  -             {
  -                     reportError(fileName, docNodeName, "Error: Element 
missing ChildNode. Expected: ");
  -                     cout <<  
c_str(TranscodeToLocalCodePage(goldNextNode->getNodeName()));
  -                     return false;
  -             }
  -     }
  -
  -     goldNextNode = gold.getNextSibling();
  -     domNextNode = doc.getNextSibling();
  -
  -     if (0 != goldNextNode)
  -     {
  -             if (0 != domNextNode)
  -             {
  -                     if ( ! domCompare(*goldNextNode, *domNextNode, 
fileName) )
  -                             return false;
  -             }
  -             else
  -             {
  -                     reportError(fileName, docNodeName, "Error: Element 
missing SiblingNode. Expected: ");
  -                     cout << 
c_str(TranscodeToLocalCodePage(goldNextNode->getNodeName()));
  -                     return false;
  -             }
  -     }
  -
  -     return true;
  -}
  -
  -
  -bool 
  -domCompare(const XalanNode& gold ,const XalanNode& doc, const XalanDOMString 
fileName)
  -{
  -     const XalanNode::NodeType       docNodeType  = doc.getNodeType();
  -     const XalanNode::NodeType       goldNodeType = gold.getNodeType();
  -
  -     const XalanDOMString&  docNodeName  = doc.getNodeName();        
  -     const XalanDOMString&  goldNodeName = gold.getNodeName();
  -
  -     const XalanDOMString&   docNodeValue  = doc.getNodeValue();
  -     const XalanDOMString&   goldNodeValue = gold.getNodeValue();
  -
  -
  -     //const XalanDOMString&  docNsUri  = doc.getNamespaceURI();
  -     //const XalanDOMString&  goldNsUri = gold.getNamespaceURI();
  -
  -     //const XalanDOMString&  docPrefix = doc.getPrefix();
  -     //const XalanDOMString&  goldPrefix = gold.getPrefix();
  -
  -     //const XalanDOMString& docLName = doc.getLocalName();
  -     //const XalanDOMString& goldLName = gold.getLocalName();
  -
  -
  -
  -     if (goldNodeType != docNodeType)
  -     {
  -             reportError(fileName, docNodeName, "Error: NodeType mismatch. 
Expected: ");
  -             cout << xalanNodeTypes[goldNodeType];                           
  -             return false;
  -     }
  -
  -     switch (goldNodeType)
  -     {
  -     case XalanNode::ELEMENT_NODE:   // ATTRIBUTE_NODE's are processed with 
diffElement().
  -     { 
  -
  -             if ( ! diffElement(gold, doc, fileName) ) 
  -             {
  -                     return false;
  -             }
  -
  -             break;
  -     }
  -     case XalanNode::TEXT_NODE:      
  -     {
  -
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -             cout << "Node is: " << 
c_str(TranscodeToLocalCodePage(docNodeValue)) << endl;
  -#endif
  -             
  -             if(goldNodeValue != docNodeValue)
  -             {
  -                     reportError(fileName, docNodeName, "Error: Text node 
mismatch. Expected: ");
  -                     cout << c_str(TranscodeToLocalCodePage(goldNodeValue));
  -                     return false;
  -             }
  -
  -             break;
  -     }
  -     case XalanNode::CDATA_SECTION_NODE:
  -     case XalanNode::ENTITY_REFERENCE_NODE:
  -     case XalanNode::ENTITY_NODE:
  -     case XalanNode::PROCESSING_INSTRUCTION_NODE:
  -     case XalanNode::COMMENT_NODE:
  -     {
  -             break;
  -     }
  -     case XalanNode::DOCUMENT_NODE:
  -     {
  -
  -#if !defined(NDEBUG) && defined(_MSC_VER)
  -             cout << "Node is: " << 
c_str(TranscodeToLocalCodePage(docNodeName)) << endl;
  -#endif
  -
  -             if (goldNodeName != docNodeName)  
  -             {
  -                     reportError(fileName, docNodeName, "Error: Missing 
Document Node");
  -             }
  -             else
  -             {
  -                     const XalanNode *goldNextNode;
  -                     const XalanNode *domNextNode;
  -
  -                     goldNextNode = gold.getFirstChild();
  -                     domNextNode = doc.getFirstChild();
  -
  -                     if (0 != goldNextNode)
  -                     {
  -                             if( ! domCompare(*goldNextNode,*domNextNode, 
fileName) )
  -                                     return false;
  -                     }
  -
  -             }
  -
  -             break;
  -     }
  -
  -     case XalanNode::DOCUMENT_TYPE_NODE:
  -     case XalanNode::DOCUMENT_FRAGMENT_NODE:
  -     case XalanNode::NOTATION_NODE:
  -     {
  -             break;
  -     }
  -     default:
  -             cout << "What are you doing? " << endl;
  -     }
  -
  -     return true;
  -}
  - 
  -*/
   FormatterListener* 
   getXMLFormatter(bool                                 shouldWriteXMLHeader,
                                bool                                    
stripCData,
  @@ -686,6 +364,7 @@
   
                                for(FileNameVectorType::size_type i = 0; i < 
files.size(); i++)
                                {
  +
                                        Hashtable attrs;
   
                                        
attrs.insert(Hashtable::value_type(XalanDOMString("idref"), files[i]));
  
  
  

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

Reply via email to