int main() { long hr; wstring errorText; // Open the geodatabase. Geodatabase geodatabase; if ((hr = OpenGeodatabase(L"C:/Project/Mpt/Data/TestFileGeodatabase10.gdb", geodatabase)) != S_OK) { wcout << "An error occurred while opening the geodatabase." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // Open the table. Table table; //if ((hr = geodatabase.OpenTable(L"\\basis2", table)) != S_OK) //if ((hr = geodatabase.OpenTable(L"\\basis2xx", table)) != S_OK) if ((hr = geodatabase.OpenTable(L"\\bodem5000", table)) != S_OK) { wcout << "An error occurred while opening the table." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // Open the metadata. string xml; if ((hr = table.GetDocumentation(xml)) != S_OK) { wcout << "An error occurred while getting the metadata." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } cout << xml; return 0; }
string xml; if ((hr = geodatabase.GetDatasetDocumentation(L"\\bodem5000",L"Raster Dataset",xml)) != S_OK) { wcout << "An error occurred while getting the metadata." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; }
// Open a RasterDataset table. Table table; if ((hr = geodatabase.OpenTable(L"\\RasterDataset", table)) != S_OK) { wcout << "An error occurred while opening the table." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // GetDefitition wcout << "Test GetDefitition:" << endl; string xmlDef; if ((hr = table.GetDefinition(xmlDef)) != S_OK) { wcout << "An error occurred getting the table definition." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } wcout << wstring(xmlDef.begin(), xmlDef.end()) << endl; // GetDocumentation wcout << "Test GetDocumentation:" << endl; string xmlDef2; if ((hr = table.GetDocumentation(xmlDef2)) != S_OK) { wcout << "An error occurred getting the table documentation." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } wcout << wstring(xmlDef2.begin(), xmlDef2.end()) << endl; ofstream myfile; myfile.open("../SchemaRetrieval/example.xml", ios::out); myfile << xmlDef; xmlDef.clear(); myfile.close(); // Open the newDoc.xml to load documentation for the feature class. string docDef; string docLine; ifstream docFile("../SchemaRetrieval/newDoc.xml"); while (getline(docFile, docLine)) docDef.append(docLine + "\n"); docFile.close(); // SetDocumentation wcout << "Test SetDocumentation:" << endl; if ((hr = table.SetDocumentation(docDef)) != S_OK) { wcout << "An error occurred setting the table documentation." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // Validate that the doc was set. wcout << "Validate that the doc was set:" << endl; if ((hr = table.GetDocumentation(xmlDef2)) != S_OK) { wcout << "An error occurred getting the table documentation." << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } wcout << wstring(xmlDef2.begin(), xmlDef2.end()) << endl;
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.