//Procura um n na �vore void* TRBTree::Search(void *data) { int comparacao; if(data == NULL) { throw TRBTreeError("Insert", "Search (NULL) isn't allowed."); } //nó para guardar o valor de pCurrent, caso data->Cod não exista na TRBTree RBNode *tmp = pCurrent; //pCurrent = ao 1º na travessia escolhida GoToRoot(); comparacao = pFnComp(data, (void *) pCurrent->Data); while((pCurrent != NULL)&&(comparacao != 0)) { if (comparacao == 1) { pCurrent = pCurrent->pRight; } else { pCurrent = pCurrent->pLeft; } comparacao = pFnComp(data, (void *) pCurrent->Data); } if (pCurrent == NULL) { pCurrent = tmp; } }
void ZXmlParser::LoadXML_FromBuffer( LPCTSTR source ) { // Reset the document ResetXML_Document( ); // Load from Buffer m_plDomDocument->loadXML( source ); m_pDocRoot = m_plDomDocument->documentElement; // Start the Parsing ParseObjects( m_plDomDocument ); // Move to the root node GoToRoot( ); }
bool ZXmlParser::LoadXML_Document( LPCTSTR strFileName ) { m_LastError = m_ok; // Reset Document ResetXML_Document( ); // Convert xml file name string to something COM can handle (BSTR) CString csFileName = strFileName; _bstr_t bstrFileName; bstrFileName = csFileName.AllocSysString( ); // Call the IXMLDOMDocumentPtr's load function to load the XML document variant_t vResult; vResult = m_plDomDocument->load( bstrFileName ); if ( ((bool) vResult) == TRUE ) // success! { // Now that the document is loaded, we need to initialize the root pointer m_pDocRoot = m_plDomDocument->documentElement; // Now we can Parse this document !! ParseObjects( m_plDomDocument ); GoToRoot( ); return( true ); } else { // XML document is not loaded, return error m_LastError = "XML Document FAILED to load: "; m_LastError += strFileName; return( false ); } }