Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

DTest.h

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

Generated on Thu Apr 30 02:30:51 2009 for ACS C++ API by doxygen 1.3.8