• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

DTest.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Log$
00020  * Revision 1.12  2004/09/08 13:57:03  peiyongz
00021  * Apache License Version 2.0
00022  *
00023  * Revision 1.11  2002/11/05 21:47:35  tng
00024  * Explicit code using namespace in application.
00025  *
00026  * Revision 1.10  2002/11/04 15:23:43  tng
00027  * C++ Namespace Support.
00028  *
00029  * Revision 1.9  2002/09/23 20:09:23  tng
00030  * DOM L3: Test baseURI with different parser's setting.
00031  *
00032  * Revision 1.8  2002/09/23 18:27:48  tng
00033  * DOM L3: Test baseURI.   Added by Gareth Reakes and Thomas Ford.
00034  *
00035  * Revision 1.7  2002/06/12 18:31:17  tng
00036  * DOM L3: test the DOMUserDataHandler and set/getUserData
00037  *
00038  * Revision 1.6  2002/05/21 18:50:16  tng
00039  * Test case update: modify to use the latest DOM interface
00040  *
00041  * Revision 1.3  2002/03/14 21:59:29  tng
00042  * Run methods test[NodeType] in the IDOMTest and other fixes.
00043  *
00044  * Revision 1.2  2002/02/01 22:44:24  peiyongz
00045  * sane_include
00046  *
00047  * Revision 1.1  2001/08/09 19:28:47  tng
00048  * Port test case DOMTest to  IDOMTest
00049  *
00050  */
00051 
00052 
00060 #include <xercesc/dom/DOM.hpp>
00061 
00062 //  define null for compatibility with original Java source code.
00063 #define null 0
00064 
00065 XERCES_CPP_NAMESPACE_USE
00066 
00067 XERCES_CPP_NAMESPACE_BEGIN
00068 class XercesDOMParser;
00069 XERCES_CPP_NAMESPACE_END
00070 
00071 
00072 class DOMTest {
00073 public:
00074         static DOMElement           *testElementNode;
00075         static DOMAttr              *testAttributeNode;
00076         static DOMText              *testTextNode;
00077         static DOMCDATASection      *testCDATASectionNode;
00078         static DOMEntityReference   *testEntityReferenceNode;
00079         static DOMEntity            *testEntityNode;
00080         static DOMProcessingInstruction *testProcessingInstructionNode;
00081         static DOMComment           *testCommentNode;
00082         static DOMDocument          *testDocumentNode;
00083         static DOMDocumentType      *testDocumentTypeNode;
00084         static DOMDocumentFragment  *testDocumentFragmentNode;
00085         static DOMNotation          *testNotationNode;
00086 
00087 
00088 DOMTest();
00089 
00090 DOMDocument* createDocument();
00091 DOMDocumentType* createDocumentType(DOMDocument* doc, XMLCh* name);
00092 DOMEntity* createEntity(DOMDocument* doc, XMLCh* name);
00093 DOMNotation* createNotation(DOMDocument* doc, XMLCh* name);
00094 bool docBuilder(DOMDocument* document, XMLCh* name);
00095 
00096 void findTestNodes(DOMDocument* document);
00097 void findTestNodes(DOMNode* node);
00098 
00099 
00100 bool testAttr(DOMDocument* document);
00101 bool testCDATASection(DOMDocument* document);
00102 bool testCharacterData(DOMDocument* document);
00103 bool testChildNodeList(DOMDocument* document);
00104 bool testComment(DOMDocument* document);
00105 bool testDeepNodeList(DOMDocument* document);
00106 
00110 bool testDocument(DOMDocument* document);
00111 
00112 
00116 bool testDocumentFragment(DOMDocument* document);
00117 
00118 bool testDocumentType(DOMDocument* document);
00119 bool testDOMerrors(DOMDocument* document);
00120 bool testDOMImplementation(DOMDocument* document);
00121 bool testElement(DOMDocument* document);
00122 bool testEntity(DOMDocument* document);
00123 bool testEntityReference(DOMDocument* document);
00124 
00125 
00130 bool testNode(DOMDocument* document);
00131 
00132 bool testNotation(DOMDocument* document);
00133 bool testPI(DOMDocument* document);
00134 bool testText(DOMDocument* document);
00135 bool treeCompare(DOMNode* node, DOMNode* node2);
00136 
00137 bool testBaseURI(XercesDOMParser* parser);
00138 
00139 };
00140 
00141 class myUserDataHandler : public DOMUserDataHandler {
00142 private:
00143     DOMOperationType currentType;
00144     XMLCh* currentKey;
00145     void* currentData;
00146     DOMNode* currentSrc;
00147     DOMNode* currentDst;
00148 
00149 public:
00150     myUserDataHandler() :
00151       currentKey(0),
00152       currentData(0),
00153       currentSrc(0),
00154       currentDst(0) {};
00155 
00156     virtual void handle(DOMOperationType operation,
00157                 const XMLCh* const key,
00158                 void* data,
00159                 const DOMNode* src,
00160                 const DOMNode* dst)
00161     {
00162         currentType = operation;
00163         currentKey = (XMLCh*) key;
00164         currentData = data;
00165         currentSrc = (DOMNode*) src;
00166         currentDst = (DOMNode*) dst;
00167     };
00168 
00169     DOMOperationType getCurrentType() {
00170         return currentType;
00171     };
00172     XMLCh* getCurrentKey() const {
00173         return currentKey;
00174     };
00175     void* getCurrentData() const {
00176         return currentData;
00177     };
00178     DOMNode* getCurrentSrc() const {
00179         return currentSrc;
00180     };
00181     DOMNode* getCurrentDst() const {
00182         return currentDst;
00183     };
00184 
00185 };
00186 
00187 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0