home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////
- //
- // [=$module]Test.cpp
- //
- // This file was generated by XMLSPY 5 Enterprise Edition.
- //
- // YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE
- // OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION.
- //
- // Refer to the XMLSPY Documentation for further details.
- // http://www.altova.com/xmlspy
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- #include "stdafx.h"
- #include "[=$module].h"
- using namespace std;
-
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE\[\] = __FILE__;
- #endif
-
-
- #ifdef _MFC_VER
- CWinApp theApp;
- #endif // _MFC_VER
-
-
- void Example()
- {
- [ foreach $class in $classes
- if $class.IsInternal
- foreach $member in $class.Members
- if $member.HasTypeObject and $member.TypeObject.NamespacePrefix <> ""
- $RootType = $member.TypeObject.NamespacePrefix & "::" & $member.Type
- else
- $RootType = $member.Type
- endif
- $RootSchemaName = $member.XmlName
- $RootNamespaceURI = $member.NamespaceURI
- next
- endif
- next
- ] ////////////////////////////////////////////////////////////////////
- //
- // TODO:
- // Insert your code here...
- //
- // Example code to create and save a structure:
- // C[=$module]Doc doc;
- // [=$RootType] root;
- // ...
- // doc.SetRootElementName(_T("[=$RootNamespaceURI]"), _T("[=$RootSchemaName]"));
- // doc.SetSchemaLocation(_T("[=$module].xsd")); // optional
- // doc.Save(_T("[=$module]1.xml"), root);
- //
- // Example code to load and save a structure:
- // C[=$module]Doc doc;
- // [=$RootType] root = doc.Load(_T("[=$module]1.xml"));
- // ...
- // doc.Save(_T("[=$module]1.xml"), root);
- //
- ////////////////////////////////////////////////////////////////////
- }
-
-
- int _tmain(int argc, TCHAR* argv\[\], TCHAR* envp\[\])
- {
- tcout << _T("[=$module] Test Application") << endl;
-
- #ifdef _MFC_VER
- if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
- {
- cerr << "Fatal Error: MFC initialization failed" << endl;
- return 1;
- }
- #endif // _MFC_VER
-
- try
- {
- #ifdef _XERCES_VERSION
- xercesc::XMLPlatformUtils::Initialize();
- #else
- CoInitialize(NULL);
- #endif
-
- Example();
-
- #ifdef _XERCES_VERSION
- xercesc::XMLPlatformUtils::Terminate();
- #else
- CoUninitialize();
- #endif
-
- tcout << _T("OK") << endl;
- return 0;
- }
- catch (CXmlException& e)
- {
- tcerr << _T("Error: ") << e.GetInfo().c_str() << endl;
- return 1;
- }
- #ifdef _XERCES_VERSION
- catch (xercesc::XMLException& e)
- {
- tcerr << _T("Xerces XMLException: ") << e.getSrcFile() << _T("(")
- << e.getSrcLine() << _T("): ") << e.getMessage() << endl;
- return 1;
- }
- catch (xercesc::DOMException& e)
- {
- tcerr << _T("Xerces DOMException ") << e.code << _T(": ")
- << e.msg << endl;
- return 1;
- }
- #else
- catch (_com_error& e)
- {
- tcerr << _T("COM-Error: ") << e.ErrorMessage() << endl;
- return 1;
- }
- #endif
- catch (std::exception& e)
- {
- cerr << "Exception: " << e.what() << endl;
- return 1;
- }
- catch (...)
- {
- tcerr << _T("Unknown error") << endl;
- return 1;
- }
- }
-