[mapguide-commits] r1076 - in trunk/MgDev: Common/MdfParser Server Server/src/Common/Manager Server/src/Core Server/src/Services/Feature Server/src/Services/Resource Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jan 29 01:38:33 EST 2007


Author: ronnielouie
Date: 2007-01-29 01:38:33 -0500 (Mon, 29 Jan 2007)
New Revision: 1076

Modified:
   trunk/MgDev/Common/MdfParser/IOAttributeRelate.cpp
   trunk/MgDev/Server/Server.sln
   trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
   trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
   trunk/MgDev/Server/src/Common/Manager/Makefile.am
   trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj
   trunk/MgDev/Server/src/Core/Makefile.am
   trunk/MgDev/Server/src/Core/ServerCore.vcproj
   trunk/MgDev/Server/src/Services/Feature/Makefile.am
   trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj
   trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.h
   trunk/MgDev/Server/src/Services/Resource/Makefile.am
   trunk/MgDev/Server/src/Services/Resource/ServerResourceService.vcproj
   trunk/MgDev/Server/src/UnitTesting/Makefile.am
   trunk/MgDev/Server/src/UnitTesting/UnitTesting.vcproj
Log:
Update feature service to use MdfParser/MdfModel to parse feature sources into an object data model.

Modified: trunk/MgDev/Common/MdfParser/IOAttributeRelate.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOAttributeRelate.cpp	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Common/MdfParser/IOAttributeRelate.cpp	2007-01-29 06:38:33 UTC (rev 1076)
@@ -191,11 +191,11 @@
     if (::wcscmp(strType, L"LeftOuter") == 0)           // NOXLATE
         type = AttributeRelate::LeftOuter;
     else if (::wcscmp(strType, L"RightOuter") == 0)     // NOXLATE 
-        AttributeRelate::RightOuter;
+        type = AttributeRelate::RightOuter;
     else if (::wcscmp(strType, L"Inner") == 0)          // NOXLATE
-        AttributeRelate::Inner;
+        type = AttributeRelate::Inner;
     else if (::wcscmp(strType, L"Association") == 0)    // NOXLATE
-        AttributeRelate::Association;
+        type = AttributeRelate::Association;
 
 	return type;
 }

Modified: trunk/MgDev/Server/Server.sln
===================================================================
--- trunk/MgDev/Server/Server.sln	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/Server.sln	2007-01-29 06:38:33 UTC (rev 1076)
@@ -78,7 +78,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerResourceService", "src\Services\Resource\ServerResourceService.vcproj", "{561F38EE-E22F-481A-8EFB-DC0AA25B4C21}"
 	ProjectSection(ProjectDependencies) = postProject
-		{F7334B1B-0EFA-47E3-8E66-DF158E61B7E4} = {F7334B1B-0EFA-47E3-8E66-DF158E61B7E4}
 		{A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425} = {A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425}
 		{5287A594-4D4F-43FE-A281-E279AB708CF1} = {5287A594-4D4F-43FE-A281-E279AB708CF1}
 		{7C1C5695-C51C-4017-ABEF-BC3032CBAF3B} = {7C1C5695-C51C-4017-ABEF-BC3032CBAF3B}
@@ -87,6 +86,7 @@
 		{ADBF25E2-C629-4832-B315-F12ABDE05632} = {ADBF25E2-C629-4832-B315-F12ABDE05632}
 		{C50254F2-654A-48DE-AF5B-20605AEF8D10} = {C50254F2-654A-48DE-AF5B-20605AEF8D10}
 		{C50254F2-765B-48DE-AF5B-31716BFF8D21} = {C50254F2-765B-48DE-AF5B-31716BFF8D21}
+		{F7334B1B-0EFA-47E3-8E66-DF158E61B7E4} = {F7334B1B-0EFA-47E3-8E66-DF158E61B7E4}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PostBuild", "src\PostBuild\PostBuild.vcproj", "{F486B768-640A-445D-8C09-437C896EFFAD}"
@@ -130,12 +130,14 @@
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerManager", "src\Common\Manager\ServerManager.vcproj", "{ADBF25E2-C629-4832-B315-F12ABDE05632}"
 	ProjectSection(ProjectDependencies) = postProject
 		{F7334B1B-0EFA-47E3-8E66-DF158E61B7E4} = {F7334B1B-0EFA-47E3-8E66-DF158E61B7E4}
+		{85882748-DD71-4D2B-9E5A-03AF8C8D91B7} = {85882748-DD71-4D2B-9E5A-03AF8C8D91B7}
 		{A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425} = {A82ADC7D-4DA4-42F2-9BF6-DF5DCFB44425}
 		{5287A594-4D4F-43FE-A281-E279AB708CF1} = {5287A594-4D4F-43FE-A281-E279AB708CF1}
 		{7C1C5695-C51C-4017-ABEF-BC3032CBAF3B} = {7C1C5695-C51C-4017-ABEF-BC3032CBAF3B}
 		{D954DAAC-E305-40CE-B3F3-C229A0BEF4F0} = {D954DAAC-E305-40CE-B3F3-C229A0BEF4F0}
 		{B50806B2-0E74-4DFD-B283-C7E380BD6F58} = {B50806B2-0E74-4DFD-B283-C7E380BD6F58}
 		{C50254F2-765B-48DE-AF5B-31716BFF8D21} = {C50254F2-765B-48DE-AF5B-31716BFF8D21}
+		{C50254F2-654A-48DE-AF5B-20605AEF8D10} = {C50254F2-654A-48DE-AF5B-20605AEF8D10}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MdfModel", "..\Common\MdfModel\MDFModel.vcproj", "{C50254F2-654A-48DE-AF5B-20605AEF8D10}"

Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2007-01-29 06:38:33 UTC (rev 1076)
@@ -153,16 +153,14 @@
         string featureSourceXmlContent;
         RetrieveFeatureSource(resourceIdentifier, featureSourceXmlContent);
 
-        // Needed to parse XML and get properties
-        MgXmlUtil xmlUtil;
-        xmlUtil.ParseString(featureSourceXmlContent.c_str());
+        // Parse XML and get properties
 
-        // Get the connection properties
-        STRING providerName;
-        STRING configDocumentName;
-        STRING longTransactionName;
-        GetConnectionPropertiesFromXml(&xmlUtil, providerName, configDocumentName, longTransactionName);
+        auto_ptr<MdfModel::FeatureSource> featureSource(GetFeatureSource(resourceIdentifier));
 
+        STRING providerName = (STRING)featureSource->GetProvider();
+        STRING configDocumentName = (STRING)featureSource->GetConfigurationDocument();
+        STRING longTransactionName = (STRING)featureSource->GetLongTransaction();
+
         providerName = UpdateProviderName(providerName);
 
         // Update the long transaction name to any active one for the current request
@@ -172,7 +170,7 @@
         pFdoConnection = m_connManager->CreateConnection(providerName.c_str());
 
         // Retrieve the properties and open the connection
-        SetConnectionProperties(pFdoConnection, &xmlUtil);
+        SetConnectionProperties(pFdoConnection, featureSource.get());
 
         SetConfiguration(providerName, pFdoConnection, resourceIdentifier, configDocumentName);
 
@@ -373,17 +371,13 @@
         // No long transaction name cached for the current session or no current session
         // In this case we want to use the requested long transaction of the feature source
 
-        // Need to parse feature source XML and get long transaction
-        MgXmlUtil xmlUtil;
-        xmlUtil.ParseString(featureSourceXmlContent.c_str());
+        // Parse feature source XML and get long transaction
 
-        DOMElement* root = xmlUtil.GetRootNode();
-        CHECKNULL(root, L"MgFdoConnectionManager.FindFdoConnection()");
+        auto_ptr<MdfModel::FeatureSource> featureSource(GetFeatureSource(resourceIdentifier));
 
-        wstring szLongTransactionName;
-        xmlUtil.GetElementValue(root, "LongTransaction", szLongTransactionName, false);
+        STRING longTransactionName = (STRING)featureSource->GetLongTransaction();
 
-        ltName = szLongTransactionName;
+        ltName = longTransactionName;
     }
 
     pFdoConnection = SearchFdoConnectionCache(resourceIdentifier->ToString(),
@@ -468,149 +462,91 @@
     return pFdoConnection;
 }
 
-
-void MgFdoConnectionManager::GetConnectionPropertiesFromXml(MgXmlUtil* pXmlUtil, STRING& providerName, STRING& configDocumentName, STRING& longTransactionName)
+void MgFdoConnectionManager::GetSpatialContextInfoFromXml(MdfModel::FeatureSource* pFeatureSource, MgSpatialContextInfoMap* spatialContextInfoMap)
 {
-    CHECKNULL(pXmlUtil, L"MgFdoConnectionManager.GetConnectionPropertiesFromXml()");
+    CHECKNULL(pFeatureSource, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
 
     MG_FDOCONNECTION_MANAGER_TRY()
 
-    DOMElement* root = pXmlUtil->GetRootNode();
-    CHECKNULL(root, L"MgFdoConnectionManager.GetConnectionPropertiesFromXml()");
+    MdfModel::SupplementalSpatialContextInfoCollection* spatialContexts = pFeatureSource->GetSupplementalSpatialContextInfo();
+    CHECKNULL(spatialContexts, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
 
-    wstring szProviderName;
-    pXmlUtil->GetElementValue(root, "Provider", szProviderName);
-
-    wstring szConfigDocumentName;
-    pXmlUtil->GetElementValue(root, "ConfigurationDocument", szConfigDocumentName, false);
-
-    wstring szLongTransactionName;
-    pXmlUtil->GetElementValue(root, "LongTransaction", szLongTransactionName, false);
-
-    if (szProviderName.length() <= 0)
+    for (int i = 0; i < spatialContexts->GetCount(); i++)
     {
-        STRING message = MgUtil::GetResourceMessage(MgResources::FeatureService, L"MgInvalidFdoProvider");
+        MdfModel::SupplementalSpatialContextInfo* spatialContext = spatialContexts->GetAt(i);
+        CHECKNULL(spatialContext, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
 
-        Ptr<MgStringCollection> strCol = (MgStringCollection*)NULL;
-        if (!message.empty())
-        {
-            strCol = new MgStringCollection();
-            strCol->Add(message);
-        }
-
-        throw new MgInvalidFeatureSourceException(L"MgFdoConnectionManager.GetConnectionPropertiesFromXml",
-            __LINE__, __WFILE__, (MgStringCollection*)strCol, L"", NULL);
-    }
-
-    // Get the provider name
-    providerName = szProviderName;
-    configDocumentName = szConfigDocumentName;
-    longTransactionName = szLongTransactionName;
-
-    MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.GetConnectionPropertiesFromXml")
-}
-
-void MgFdoConnectionManager::GetSpatialContextInfoFromXml(MgXmlUtil* pXmlUtil, MgSpatialContextInfoMap* spatialContextInfoMap)
-{
-    CHECKNULL(pXmlUtil, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml()");
-
-    MG_FDOCONNECTION_MANAGER_TRY()
-
-    DOMNodeList* nodeList = pXmlUtil->GetNodeList("SupplementalSpatialContextInfo" /* NOXLATE */ );
-    CHECKNULL(nodeList, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml()");
-
-    int nodes = (int)nodeList->getLength();
-
-    for (int i = 0; i < nodes; i++)
-    {
-        DOMNode* node = nodeList->item(i);
-        CHECKNULL(node, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
-
         // Name element
-        wstring name;
-        pXmlUtil->GetElementValue((DOMElement*)node, "Name", name, false);
-
+        STRING name = (STRING)spatialContext->GetName();
         FdoString* propertyName = name.c_str();
         CHECKNULL(propertyName, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
 
         // CoordinateSystem element
-        wstring coordinateSystem;
-        pXmlUtil->GetElementValue((DOMElement*)node, "CoordinateSystem", coordinateSystem, false);
-
+        STRING coordinateSystem = (STRING)spatialContext->GetCoordinateSystem();
         FdoString* propertyCoordinateSystem = coordinateSystem.c_str();
         CHECKNULL(propertyCoordinateSystem, L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");
 
         spatialContextInfoMap->insert( MgSpatialContextInfoPair(name, coordinateSystem) );
     }
 
-    MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.GetSpatialContextInfoFromXml")
+    MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.GetSpatialContextInfoFromXml");    
 }
 
-
-void MgFdoConnectionManager::SetConnectionProperties(FdoIConnection* pFdoConnection, MgXmlUtil* pXmlUtil)
+void MgFdoConnectionManager::SetConnectionProperties(FdoIConnection *pFdoConnection, MdfModel::FeatureSource *pFeatureSource)
 {
-    CHECKNULL(pXmlUtil, L"MgFdoConnectionManager.SetConnectionProperties()");
-    CHECKNULL((FdoIConnection*)pFdoConnection, L"MgFdoConnectionManager.SetConnectionProperties()");
+        CHECKNULL(pFeatureSource, L"MgFdoConnectionManager.SetConnectionProperties");
+        CHECKNULL((FdoIConnection*)pFdoConnection, L"MgFdoConnectionManager.SetConnectionProperties");
 
-    // Get FdoIConnectionInfo
-    FdoPtr<FdoIConnectionInfo> fdoConnInfo = pFdoConnection->GetConnectionInfo();
-    CHECKNULL((FdoIConnectionInfo*)fdoConnInfo, L"MgFdoConnectionManager.SetConnectionProperties()");
+        // Get FdoIConnectionInfo
+        FdoPtr<FdoIConnectionInfo> fdoConnInfo = pFdoConnection->GetConnectionInfo();
+        CHECKNULL((FdoIConnectionInfo*)fdoConnInfo, L"MgFdoConnectionManager.SetConnectionProperties");
 
-    // Get FdoIConnectionPropertyDictionary
-    FdoPtr<FdoIConnectionPropertyDictionary> fdoConnPropertyDict = fdoConnInfo->GetConnectionProperties();
-    CHECKNULL((FdoIConnectionPropertyDictionary*)fdoConnPropertyDict, L"MgFdoConnectionManager.SetConnectionProperties");
+        // GetFdoIConnectionPropertyDictionary
+        FdoPtr<FdoIConnectionPropertyDictionary> fdoConnPropertyDict = fdoConnInfo->GetConnectionProperties();
+        CHECKNULL((FdoIConnectionPropertyDictionary*)fdoConnPropertyDict, L"MgFdoConnectionManager.SetConnectionProperties");
 
-    // Get all nodes of properties
-    DOMNodeList* nodeList = pXmlUtil->GetNodeList("Parameter" /* NOXLATE */ );
-    CHECKNULL(nodeList, L"MgFdoConnectionManager.SetConnectionProperties");
+        // Get all all connection properties
+        MdfModel::NameStringPairCollection* parameters = pFeatureSource->GetParameters();
+        CHECKNULL(parameters, L"MgFdoConnectionManager.SetConnectionProperties");
 
-    int nodes = (int)nodeList->getLength();
-
-    for (int i=0; i < nodes; i++)
-    {
-        DOMNode* node = nodeList->item(i);
-        CHECKNULL(node, L"MgFdoConnectionManager.SetConnectionProperties");
-
-        // Name element
-        wstring name;
-        pXmlUtil->GetElementValue((DOMElement*)node, "Name", name);
-
-        // Value element
-        wstring value;
-        pXmlUtil->GetElementValue((DOMElement*)node, "Value", value, false);
-
-        // If name is null, means invalid xml
-        if (name.empty())
+        for (int i = 0; i < parameters->GetCount(); i++)
         {
-            STRING message = MgUtil::GetResourceMessage(MgResources::FeatureService, L"MgInvalidPropertyName");
+            // Get the Name and Value elements
+            MdfModel::NameStringPair* pair = parameters->GetAt(i);
+            STRING name = (STRING)pair->GetName();
+            STRING value = (STRING)pair->GetValue();
 
-            Ptr<MgStringCollection> strCol = (MgStringCollection*)NULL;
-            if (!message.empty())
+            // If name is null, means invalid xml
+            if (name.empty())
             {
-                strCol = new MgStringCollection();
-                strCol->Add(message);
-            }
+                STRING message = MgUtil::GetResourceMessage(MgResources::FeatureService, L"MgInvalidPropertyName");
 
-            throw new MgInvalidFeatureSourceException(L"MgFdoConnectionManager.SetConnectionProperties",
-                __LINE__, __WFILE__, (MgStringCollection*)strCol, L"", NULL);
-        }
+                Ptr<MgStringCollection> strCol;
+                if (!message.empty())
+                {
+                    strCol = new MgStringCollection();
+                    strCol->Add(message);
+                }
 
-        FdoString* propertyName = name.c_str();
-        CHECKNULL(propertyName, L"MgFdoConnectionManager.SetConnectionProperties");
+                throw new MgInvalidFeatureSourceException(L"MgFdoConnectionManager.SetConnectionProperties",
+                    __LINE__, __WFILE__, (MgStringCollection*)strCol, L"", NULL);
+            }
 
-        // Property value can be null ( optional properties may not have values )
-        if (!value.empty())
-        {
-            FdoString* propertyValue = value.c_str();
-            if (propertyValue != NULL)
+            FdoString* propertyName = name.c_str();
+            CHECKNULL(propertyName, L"MgFdoConnectionManager.SetConnectionProperties");
+
+            // Property value can be null ( optional properties may not have values )
+            if (!value.empty())
             {
-                fdoConnPropertyDict->SetProperty(propertyName,  propertyValue);
+                FdoString* propertyValue = value.c_str();
+                if (propertyValue != NULL)
+                {
+                    fdoConnPropertyDict->SetProperty(propertyName, propertyValue);
+                }
             }
         }
-    }
 }
 
-
 void MgFdoConnectionManager::ActivateSpatialContext(FdoIConnection* pFdoConnection, STRING& spatialContextName)
 {
     CHECKNULL((FdoIConnection*)pFdoConnection, L"MgFdoConnectionManager.ActivateSpatialContext()");
@@ -928,14 +864,14 @@
     string featureSourceXmlContent;
     RetrieveFeatureSource(resourceIdentifier, featureSourceXmlContent);
 
-    // Needed to parse XML and get properties
-    MgXmlUtil xmlUtil;
-    xmlUtil.ParseString(featureSourceXmlContent.c_str());
+    // Parse XML and get properties
 
+    auto_ptr<MdfModel::FeatureSource> featureSource(GetFeatureSource(resourceIdentifier));
+
     // Get the supplementary spatial context information which defines the coordinate system
     // for spatial contexts that are missing this information
     spatialContextInfoMap = new MgSpatialContextInfoMap();
-    GetSpatialContextInfoFromXml(&xmlUtil, spatialContextInfoMap);
+    GetSpatialContextInfoFromXml(featureSource.get(), spatialContextInfoMap);
 
     MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.GetSpatialContextInfo")
 
@@ -1284,3 +1220,23 @@
 
     return bResult;
 }
+
+MdfModel::FeatureSource* MgFdoConnectionManager::GetFeatureSource(MgResourceIdentifier* resId)
+{
+    // Retrieve XML from repository
+    string featureSourceXmlContent;
+    RetrieveFeatureSource(resId, featureSourceXmlContent);
+
+    MdfParser::FSDSAX2Parser parser;
+    parser.ParseString(featureSourceXmlContent.c_str(), featureSourceXmlContent.length()*sizeof(char));
+
+    assert(parser.GetSucceeded());
+
+    // detach the feature source from the parser - it's
+    // now the caller's responsibility to delete it
+    MdfModel::FeatureSource* fs = parser.DetachFeatureSource();
+
+    assert(fs != NULL);
+    return fs;
+}
+

Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h	2007-01-29 06:38:33 UTC (rev 1076)
@@ -28,6 +28,7 @@
 #include "MapGuideCommon.h"
 #include "Fdo.h"
 #include "ServerFeatureServiceExceptionDef.h"
+#include "FSDSAX2Parser.h"
 
 class MgXmlUtil;
 
@@ -75,6 +76,8 @@
 
     void RetrieveFeatureSource(MgResourceIdentifier* resource, string& resourceContent);
 
+    MdfModel::FeatureSource* GetFeatureSource(MgResourceIdentifier* resId);
+
     void RemoveExpiredConnections();
     bool RemoveCachedFdoConnection(CREFSTRING key);
 
@@ -92,11 +95,11 @@
     void CacheFdoConnection(FdoIConnection* pFdoConnection, CREFSTRING key, string& data, CREFSTRING ltName);
     bool FdoConnectionCacheFull(void);
 
-    void GetConnectionPropertiesFromXml(MgXmlUtil* pXmlUtil, STRING& providerName, STRING& configDocumentName, STRING& longTransactionName);
-    void GetSpatialContextInfoFromXml(MgXmlUtil* pXmlUtil, MgSpatialContextInfoMap* spatialContextInfoMap);
+    void GetSpatialContextInfoFromXml(MdfModel::FeatureSource* pFeatureSource, MgSpatialContextInfoMap* spatialContextInfoMap);
 
     void SetConfiguration(CREFSTRING providerName, FdoIConnection* pFdoConnection, MgResourceIdentifier* resourceIdentifier, STRING& configDataName);
     void SetConnectionProperties(FdoIConnection* pFdoConnection, MgXmlUtil* pXmlUtil);
+    void SetConnectionProperties(FdoIConnection* pFdoConnection, MdfModel::FeatureSource* pFeatureSource);
 
     void ActivateSpatialContext(FdoIConnection* pFdoConnection, STRING& spatialContextName);
     void ActivateLongTransaction(FdoIConnection* pFdoConnection, STRING& longTransactionName);

Modified: trunk/MgDev/Server/src/Common/Manager/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/Makefile.am	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Common/Manager/Makefile.am	2007-01-29 06:38:33 UTC (rev 1076)
@@ -14,6 +14,8 @@
   -I../../../../Common/Geometry \
   -I../../../../Common/MapGuideCommon \
   -I../../../../Common/PlatformBase \
+  -I../../../../Common/MdfModel \
+  -I../../../../Common/MdfParser \
   -I../../Services/Drawing \
   -I../../Services/Feature \
   -I../../Services/Kml \

Modified: trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj	2007-01-29 06:38:33 UTC (rev 1076)
@@ -41,7 +41,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Services\Drawing;..\..\Services\Feature;..\..\Services\Mapping;..\..\Services\Rendering;..\..\Services\Resource;..\..\Services\ServerAdmin;..\..\Services\Site;..\..\Services\Tile;..\..\Services\Kml;..\ServerUtil;..\..\Common\Thread;..\..\Gws\Include"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\Services\Drawing;..\..\Services\Feature;..\..\Services\Mapping;..\..\Services\Rendering;..\..\Services\Resource;..\..\Services\ServerAdmin;..\..\Services\Site;..\..\Services\Tile;..\..\Services\Kml;..\ServerUtil;..\..\Common\Thread;..\..\Gws\Include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_MANAGER_EXPORTS"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
@@ -125,7 +125,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Services\Drawing;..\..\Services\Feature;..\..\Services\Mapping;..\..\Services\Rendering;..\..\Services\Resource;..\..\Services\ServerAdmin;..\..\Services\Site;..\..\Services\Tile;..\..\Services\Kml;..\ServerUtil;..\..\Common\Thread;..\..\Gws\Include"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common/MdfParser;..\..\Services\Drawing;..\..\Services\Feature;..\..\Services\Mapping;..\..\Services\Rendering;..\..\Services\Resource;..\..\Services\ServerAdmin;..\..\Services\Site;..\..\Services\Tile;..\..\Services\Kml;..\ServerUtil;..\..\Common\Thread;..\..\Gws\Include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_SERVER_MANAGER_EXPORTS"
 				ExceptionHandling="2"
 				RuntimeLibrary="2"

Modified: trunk/MgDev/Server/src/Core/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Core/Makefile.am	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Core/Makefile.am	2007-01-29 06:38:33 UTC (rev 1076)
@@ -28,6 +28,7 @@
   -I../../../Common/MapGuideCommon \
   -I../../../Oem/gd/freetype/include \
   -I../../../Common/MdfModel \
+  -I../../../Common/MdfParser \
   -I../../../Common/Stylization
 
 bin_PROGRAMS = mgserver

Modified: trunk/MgDev/Server/src/Core/ServerCore.vcproj
===================================================================
--- trunk/MgDev/Server/src/Core/ServerCore.vcproj	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Core/ServerCore.vcproj	2007-01-29 06:38:33 UTC (rev 1076)
@@ -40,7 +40,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Base;..\Common\Thread;..\Services\Drawing;..\Services\Feature;..\Common\Manager;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile;..\Services\Kml;..\..\..\Oem\gd\freeetype\include;..\..\..\Common\MdfModel;..\..\..\Common\Stylization;..\..\..\Oem\gd\freetype\include;..\..\..\Common\"
+				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Base;..\Common\Thread;..\Services\Drawing;..\Services\Feature;..\Common\Manager;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile;..\Services\Kml;..\..\..\Oem\gd\freeetype\include;..\..\..\Common\MdfModel;..\..\..\Common\MdfParser;..\..\..\Common\Stylization;..\..\..\Oem\gd\freetype\include;..\..\..\Common\"
 				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;ACE_HAS_SVC_DLL=1"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
@@ -122,7 +122,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Base;..\Common\Thread;..\Services\Drawing;..\Services\Feature;..\Common\Manager;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile;..\Services\Kml;..\..\..\Oem\gd\freeetype\include;..\..\..\Common\MdfModel;..\..\..\Common\Stylization;..\..\..\Oem\gd\freetype\include;..\..\..\Common\"
+				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Base;..\Common\Thread;..\Services\Drawing;..\Services\Feature;..\Common\Manager;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile;..\Services\Kml;..\..\..\Oem\gd\freeetype\include;..\..\..\Common\MdfModel;..\..\..\Common\MdfParser;..\..\..\Common\Stylization;..\..\..\Oem\gd\freetype\include;..\..\..\Common\"
 				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;ACE_HAS_SVC_DLL=1"
 				StringPooling="true"
 				ExceptionHandling="2"

Modified: trunk/MgDev/Server/src/Services/Feature/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/Makefile.am	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/Makefile.am	2007-01-29 06:38:33 UTC (rev 1076)
@@ -15,6 +15,8 @@
   -I../../../../Common/Geometry \
   -I../../../../Common/PlatformBase \
   -I../../../../Common/MapGuideCommon \
+  -I../../../../Common/MdfModel \
+  -I../../../../Common/MdfParser \
   -I../../Common \
   -I../../Common/Base \
   -I../../Common/Manager \

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp	2007-01-29 06:38:33 UTC (rev 1076)
@@ -27,7 +27,7 @@
 
 
 //////////////////////////////////////////////////////////////////
-MgServerDescribeSchema::MgServerDescribeSchema()
+MgServerDescribeSchema::MgServerDescribeSchema() : m_featureSource(NULL)
 {
 }
 
@@ -35,6 +35,11 @@
 //////////////////////////////////////////////////////////////////
 MgServerDescribeSchema::~MgServerDescribeSchema()
 {
+    if (m_featureSource != NULL)
+    {
+        delete m_featureSource;
+        m_featureSource = NULL;
+    }
 }
 
 
@@ -71,53 +76,39 @@
     string featureSourceXmlContent;
     RetrieveFeatureSource(resource, featureSourceXmlContent);
 
-    // Need to parse XML and get properties
-    MgXmlUtil xmlUtil;
-    xmlUtil.ParseString(featureSourceXmlContent.c_str());
+    CHECKNULL(m_featureSource, L"MgServerDescribeSchema.ExecuteDescribeSchema");
 
-    DOMElement* rootNode = xmlUtil.GetRootNode();
-    DOMNodeList* extensionNodeList = xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
-    CHECKNULL(extensionNodeList, L"MgServerDescribeSchema.ExecuteDescribeSchema()");
+    MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+    CHECKNULL(extensions, L"MgServerDescribeSchema.ExecuteDescribeSchema");
 
-    int extensionNodes = (int)extensionNodeList->getLength();
-
-    for (int i = 0; i < extensionNodes; i++)
+    for (int i = 0; i < extensions->GetCount(); i++)
     {
-        DOMNode* extensionNode = extensionNodeList->item(i);
-        CHECKNULL(extensionNode, L"MgServerDescribeSchema.ExecuteDescribeSchema");
+        MdfModel::Extension* extension = extensions->GetAt(i);
+        CHECKNULL(extension, L"MgServerDescribeSchema.ExecuteDescribeSchema");
 
-        DOMNodeList* nameNodeList = xmlUtil.GetNodeList(extensionNode, "Name");
-        int nNameNodes = (int)nameNodeList->getLength();
+        // Get the extension name
+        STRING extensionName = (STRING)extension->GetName();
 
-        // get the extension name node
-        DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
+        // Determine the number of secondary sources (AttributeRelates)
+        MdfModel::AttributeRelateCollection* attributeRelates = extension->GetAttributeRelates();
+        CHECKNULL(attributeRelates, L"MgServerDescribeSchema.ExecuteDescribeSchema");
+        int nAttributeRelates = attributeRelates->GetCount();
 
-        // get the extension name value
-        STRING extensionName;
-        xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, extensionName);
-
-        // Determine the number of secondary sources (AttributeRelate nodes)
-        DOMNodeList* attributeRelateNodeList = xmlUtil.GetNodeList(extensionNode, "AttributeRelate");
-        int nAttributeRelateNodes = (int)attributeRelateNodeList->getLength();
-
-        for (int arNodesIndex = 0; arNodesIndex < nAttributeRelateNodes; arNodesIndex++)
+        for (int arIndex = 0; arIndex < nAttributeRelates; arIndex++)
         {
-            // get the atribute relate node
-            DOMNode* attributeRelateNode = attributeRelateNodeList->item(arNodesIndex);
+            MdfModel::AttributeRelate* attributeRelate = attributeRelates->GetAt(arIndex);
+            CHECKNULL(attributeRelate, L"MgServerDescribeSchema.ExecuteDescribeSchema");
 
             // get the resource id of the secondary feature source
-            STRING secondaryResourceId;
-            xmlUtil.GetElementValue(attributeRelateNode, "ResourceId", secondaryResourceId);
+            STRING secondaryResourceId = (STRING)attributeRelate->GetResourceId();
 
-            // Get the name for the join relationship (attribute relate name)
-            STRING attributeRelateName;
-            xmlUtil.GetElementValue(attributeRelateNode, "Name", attributeRelateName);
+            // get the name for the join relationship (attribute relate name)
+            STRING attributeRelateName = (STRING)attributeRelate->GetName();
 
             // Get the secondary feature class (AttributeClass)
-            STRING attributeClass;
-            xmlUtil.GetElementValue(attributeRelateNode, "AttributeClass", attributeClass);
+            STRING attributeClass = (STRING)attributeRelate->GetAttributeClass();
 
-            // Parse the schema name form the classname;
+            // Parse the schema name from the classname;
             STRING::size_type nDelimiter = attributeClass.find(L":");
             STRING secSchemaName;
             STRING secClassName;
@@ -163,10 +154,9 @@
                         continue;
                     }
 
-
                     // Prefix the schema name with the extension and attribute relate names
                     STRING modifiedSchemaName;
-                    modifiedSchemaName =  L"[" + extensionName + L"]";
+                    modifiedSchemaName = L"[" + extensionName + L"]";
                     modifiedSchemaName += L"[" + attributeRelateName + L"]";
                     modifiedSchemaName += fdoSchemaName;
                     FdoString* msn = modifiedSchemaName.c_str();
@@ -178,11 +168,11 @@
                         ffsc->Add(ffs);
                     }
                 }
-            }
+            }  
 
-        }  // End of for-loop that iterates thru the secondary sources
+        }  // End of the for-loop that iterates thru the secondary sources
 
-    }  // End of for loop that iteratates thru the extensions in the feature source
+    }  // End of for loop that iterates thru the extensions in the feature source
 
     MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgServerDescribeSchema.ExecuteDescribeSchema")
 
@@ -274,44 +264,30 @@
             string featureSourceXmlContent;
             RetrieveFeatureSource(resource, featureSourceXmlContent);
 
-            // Parse the XML and get properties
-            MgXmlUtil xmlUtil;
-            xmlUtil.ParseString(featureSourceXmlContent.c_str());
+            CHECKNULL(m_featureSource, L"MgServerDescribeSchema.DescribeSchema");
 
-            // Determine how may extension nodes
-            DOMElement* rootNode = xmlUtil.GetRootNode();
-            DOMNodeList* extensionNodeList = xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
-            CHECKNULL(extensionNodeList, L"MgServerDescribeSchema.DescribeSchema()");
-            int nExtensionNodes = (int)extensionNodeList->getLength();
+            MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+            CHECKNULL(extensions, L"MgServerDescribeSchema.DescribeSchema");
 
-            // For each extension node
-            for (int nExtNodeIndex = 0; nExtNodeIndex < nExtensionNodes; nExtNodeIndex++)
+            for (int i = 0; i < extensions->GetCount(); i++)
             {
                 Ptr<MgClassDefinition> extClassDefinition;
 
-                DOMNode* extensionNode = extensionNodeList->item(nExtNodeIndex);
-                CHECKNULL(extensionNode, L"MgServerDescribeSchema.DescribeSchema");
+                MdfModel::Extension* extension = extensions->GetAt(i);
+                CHECKNULL(extension, L"MgServerDescribeSchema.DescribeSchema");
+    
+                // Get the extension name
+                STRING extensionName = (STRING)extension->GetName();
 
-                DOMNodeList* nameNodeList = xmlUtil.GetNodeList(extensionNode, "Name");
-                int nNameNodes = (int)nameNodeList->getLength();
-
-                // get the extension name node
-                DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
-
-                // get the extension name value
-                STRING extensionName;
-                xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, extensionName);
-
                 // get FeatureClass element - this tells us which class is extended (SchemaName:ClassName)
-                STRING featureClass;
-                xmlUtil.GetElementValue(extensionNode, "FeatureClass", featureClass);
+                STRING featureClass = (STRING)extension->GetFeatureClass();
 
-                // Parse the schemaname from the classname
+                // Parse the schemaName from the className
                 STRING::size_type nDelimiter = featureClass.find(L":");
                 STRING primSchemaName;
                 STRING primClassName;
 
-                if(STRING::npos == nDelimiter)
+                if (STRING::npos == nDelimiter)
                 {
                     primSchemaName = L"";
                     primClassName = featureClass;
@@ -340,7 +316,7 @@
                         continue;
                     }
 
-                    // get the class collection for for this schema
+                    // get the class collection for this schema
                     FdoPtr<FdoClassCollection> fcc = ffs->GetClasses();
                     FdoInt32 classCnt = fcc->GetCount();
 
@@ -367,28 +343,29 @@
 
                 //
                 // Finished adding primary class properties to the extension class definition
-                // Now add the secondary class properties.
+                // Now add the secondary class properties
                 //
 
-                // Determine the number of secondary sources (AttributeRelate nodes)
-                DOMNodeList* attributeRelateNodeList = xmlUtil.GetNodeList(extensionNode, "AttributeRelate");
-                int nAttributeRelateNodes = (int)attributeRelateNodeList->getLength();
+                // Determine the number of secondary sources (AttributeRelates)
+                MdfModel::AttributeRelateCollection* attributeRelates = extension->GetAttributeRelates();
+                CHECKNULL(attributeRelates, L"MgDescribeSchema.DescribeSchema");
+                int nAttributeRelateCount = attributeRelates->GetCount();
 
-                for (int arNodesIndex = 0; arNodesIndex < nAttributeRelateNodes; arNodesIndex++)
+                for (int arIndex = 0; arIndex < nAttributeRelateCount; arIndex++)
                 {
-                    // get the attribute relate node
-                    DOMNode* attributeRelateNode = attributeRelateNodeList->item(arNodesIndex);
+                    // get the attribute relate
+                    MdfModel::AttributeRelate* attributeRelate = attributeRelates->GetAt(arIndex);
+                    CHECKNULL(attributeRelate, L"MgDescribeSchema.DescribeSchema");
 
                     // Get the name of the secondary feature class (AttributeClass)
-                    STRING attributeClass;
-                    xmlUtil.GetElementValue(attributeRelateNode, "AttributeClass", attributeClass);
+                    STRING attributeClass = (STRING)attributeRelate->GetAttributeClass();
 
                     // Parse the schema name from the class name;
                     STRING::size_type nDelimiter = attributeClass.find(L":");
                     STRING secSchemaName;
                     STRING secClassName;
 
-                    if(STRING::npos == nDelimiter)
+                    if (STRING::npos == nDelimiter)
                     {
                         secSchemaName = L"";
                         secClassName = attributeClass;
@@ -400,16 +377,13 @@
                     }
 
                     // Get the relation name
-                    STRING relationName;
-                    xmlUtil.GetElementValue(attributeRelateNode, "Name", relationName);
+                    STRING relationName = (STRING)attributeRelate->GetName();
 
-                    // Get the attribute name delimiter ( if none specified, default will be "" (blank) )
-                    STRING attributeNameDelimiter;
-                    xmlUtil.GetElementValue(attributeRelateNode, "AttributeNameDelimiter", attributeNameDelimiter, false);
+                    // Get the attributeName delimiter ( if none specified, default will be "" (blank) )
+                    STRING attributeNameDelimiter = (STRING)attributeRelate->GetAttributeNameDelimiter();
 
-                    // get the resource id of the secondary feature source
-                    STRING secondaryResourceId;
-                    xmlUtil.GetElementValue(attributeRelateNode, "ResourceId", secondaryResourceId);
+                    // Get the resource id of the secondary feature source
+                    STRING secondaryResourceId = (STRING)attributeRelate->GetResourceId();
 
                     // Establish connection to provider for secondary feature source
                     Ptr<MgResourceIdentifier> secondaryFeatureSource = new MgResourceIdentifier(secondaryResourceId);
@@ -425,12 +399,12 @@
                         }
                         else
                         {
-                            throw new MgConnectionFailedException(L"MgServerDescribeSchema::DescribeSchema()", __LINE__, __WFILE__, NULL, L"", NULL);
+                            throw new MgConnectionFailedException(L"MgServerDescribeSchema.DescribeSchema", __LINE__, __WFILE__, NULL, L"", NULL);
                         }
 
                         // Get the schema collection for the secondary resource
                         FdoPtr<FdoIConnection> fdoConn2 = connection2->GetConnection();
-                        FdoPtr<FdoIDescribeSchema> fdoCommand2 = (FdoIDescribeSchema*)fdoConn2->CreateCommand(FdoCommandType_DescribeSchema);
+                        FdoPtr<FdoIDescribeSchema> fdoCommand2  = (FdoIDescribeSchema*)fdoConn2->CreateCommand(FdoCommandType_DescribeSchema);
                         CHECKNULL((FdoIDescribeSchema*)fdoCommand2, L"MgDescribeSchema.DescribeSchema");
                         ffsc2 = fdoCommand2->Execute();
 
@@ -498,9 +472,9 @@
 
                             break;
 
-                        } // end loop thru secondary schemas
+                        }  // end loop thru secondary schemas
 
-                    } // end if (NULL != secfeatureSource)
+                    }  // end if (NULL != secFeatureSource)
 
                 }  // end loop thru all attribute relates (joins)
 
@@ -509,7 +483,7 @@
                     extClassDefinition->SetName(extensionName);
                 }
 
-                // Add the extension class definition to theMgClassDefinitionCollection
+                // Add the extension class definition to the MgClassDefinitionCollection
                 classCol->Add(extClassDefinition);
 
             }  // Repeat for all extensions
@@ -1547,43 +1521,24 @@
                 string featureSourceXmlContent;
                 RetrieveFeatureSource(resource, featureSourceXmlContent);
 
-                // Need to parse XML and get properties
-                MgXmlUtil xmlUtil;
-                xmlUtil.ParseString(featureSourceXmlContent.c_str());
+                CHECKNULL(m_featureSource, L"MgServerDescribeSchema.GetIdentityProperties");
 
-                DOMElement* rootNode = xmlUtil.GetRootNode();
-                DOMNodeList* extensionNodeList = xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
-                CHECKNULL(extensionNodeList, L"MgServerDescribeSchema.GetIdentityProperties");
-
-                int extensionNodes = (int)extensionNodeList->getLength();
+                MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+                CHECKNULL(extensions, L"MgServerDescribeSchema.GetIdentityProperties");
                 STRING extensionFeatureClass;
 
-                for (int i = 0; i < extensionNodes; i++)
+                for (int i = 0; i < extensions->GetCount(); i++)
                 {
-                    DOMNode* extensionNode = extensionNodeList->item(i);
-                    CHECKNULL(extensionNode, L"MgServerDescribeSchema.GetIdentityProperties");
+                    MdfModel::Extension* extension = extensions->GetAt(i);
+                    CHECKNULL(extension, L"MgServerDescribeSchema.GetIdentityProperties");
 
-                    DOMNodeList* nameNodeList = xmlUtil.GetNodeList(extensionNode, "Name");
-                    int nNameNodes = (int)nameNodeList->getLength();
+                    // Get the extension name
+                    STRING extensionName = (STRING)extension->GetName();
 
-                    // get the extension name node
-                    DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
-
-                    // get the extension name value
-                    STRING extensionName;
-                    xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, extensionName);
-
                     if (className == extensionName)
                     {
-                        DOMNodeList* featureClassNodeList = xmlUtil.GetNodeList(extensionNode, "FeatureClass");
-                        int nFeatureClassNodes = (int)featureClassNodeList->getLength();
+                        extensionFeatureClass = (STRING)extension->GetFeatureClass();
 
-                        // get the extension feature class node
-                        DOMNode* extensionFeatureClassNode = featureClassNodeList->item(nFeatureClassNodes - 1);
-
-                        // get the extension feature class value
-                        xmlUtil.GetTextFromElement((DOMElement*)extensionFeatureClassNode, extensionFeatureClass);
-
                         // Loop thru the class collection
                         for (int classIndex = 0; classIndex < classCnt; classIndex++)
                         {
@@ -1614,10 +1569,10 @@
                             }  // end if (qualifiedName == extensionFeatureClass)
                         }  // end loop thru class collection
                     }  // end if (className == extensionName)
-                }  // end loop thru extension nodes
+                }  // end loop thru extensions
+
             }  // end find identity properties for extension class
         }
-
         featureServiceCache->AddIdentityProperties(resource, schemaName, className, idProps);
     }
 
@@ -1638,4 +1593,26 @@
     {
          pFdoConnectionManager->RetrieveFeatureSource(resource, resourceContent);
     }
+
+    if (m_featureSource == NULL)
+    {
+        m_featureSource = GetFeatureSource(resource);
+    }
 }
+
+MdfModel::FeatureSource* MgServerDescribeSchema::GetFeatureSource(MgResourceIdentifier* resource)
+{
+    CHECKNULL(resource, L"MgServerDescribeSchema.GetFeatureSource");
+
+    MdfModel::FeatureSource* fs = NULL;
+
+    // Get the feature source XML content document from the FDO connection manager.
+    MgFdoConnectionManager* pFdoConnectionManager = MgFdoConnectionManager::GetInstance();
+    if(pFdoConnectionManager)
+    {
+         fs = pFdoConnectionManager->GetFeatureSource(resource);
+    }
+
+    assert (fs != NULL);
+    return fs;
+}

Modified: trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.h	2007-01-29 06:38:33 UTC (rev 1076)
@@ -22,6 +22,7 @@
 #include "System/XmlDefs.h"
 #include "System/XmlUtil.h"
 #include "Fdo.h"
+#include "FSDSAX2Parser.h"
 
 class MgServerDescribeSchema
 {
@@ -60,6 +61,10 @@
     STRING GetSerializedXml(FdoFeatureSchemaCollection* fdoSchemaCol);
 
     void RetrieveFeatureSource(MgResourceIdentifier* resource, string& resourceContent);
+    MdfModel::FeatureSource* GetFeatureSource(MgResourceIdentifier* resource);
+
+    MdfModel::FeatureSource* m_featureSource;
+
 };
 
 #endif

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.vcproj	2007-01-29 06:38:33 UTC (rev 1076)
@@ -41,7 +41,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\..\Gws\Include;..\..\Gws\GwsCommon\inc"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\..\Gws\Include;..\..\Gws\GwsCommon\inc"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_FEATURE_EXPORTS"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
@@ -123,7 +123,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\..\Gws\Include;..\..\Gws\GwsCommon\inc"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\..\Gws\Include;..\..\Gws\GwsCommon\inc"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_SERVER_FEATURE_EXPORTS"
 				ExceptionHandling="2"
 				RuntimeLibrary="2"

Modified: trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.cpp	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.cpp	2007-01-29 06:38:33 UTC (rev 1076)
@@ -39,11 +39,18 @@
     m_customPropertyFound = false;
     m_customFunction = NULL;
     m_customPropertyName = L"";
+    m_featureSource = NULL;
 }
 
 MgServerSelectFeatures::~MgServerSelectFeatures()
 {
     FDO_SAFE_RELEASE(m_customFunction);
+
+    if (m_featureSource != NULL)
+    {
+        delete m_featureSource;
+        m_featureSource = NULL;
+    }
 }
 
 // Executes the select features command and serializes the reader
@@ -64,9 +71,6 @@
     string featureSourceXmlContent;
     RetrieveFeatureSource(resource, featureSourceXmlContent);
 
-    // Parse the feature source XML document so that it will be ready to be walked for needed property information
-    m_xmlUtil.ParseString(featureSourceXmlContent.c_str());
-
     // Check if a feature join is to be performed by inspecting the resource for join properties
     bool bFeatureJoinProperties = FindFeatureJoinProperties(resource, className);
     if (!isSelectAggregate && bFeatureJoinProperties)
@@ -775,43 +779,30 @@
 // Look for extension (feature join) properties in the feature source document
 bool MgServerSelectFeatures::FindFeatureJoinProperties(MgResourceIdentifier* resourceId, CREFSTRING extensionName)
 {
+    CHECKNULL(m_featureSource, L"MgServerSelectFeatures.FindFeatureJoinProperties");    
     bool bJoinPropertiesExists = false;
 
-    DOMElement* rootNode = m_xmlUtil.GetRootNode();
-    DOMNodeList* extensionNodeList = m_xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
+    MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+    CHECKNULL(extensions, L"MgServerSelectFeatures.FindFeatureJoinProperties");
 
-    if (NULL != extensionNodeList)
+    for (int i = 0; i < extensions->GetCount(); i++)
     {
-        int extensionNodes = (int)extensionNodeList->getLength();
+        MdfModel::Extension* extension = extensions->GetAt(i);
+        CHECKNULL(extension, L"MgServerSelectFeatures.FindFeatureJoinProperties");        
+        STRING name = (STRING)extension->GetName();
 
-        for (int i = 0; i < extensionNodes; i++)
-        {
-            DOMNode* extensionNode = extensionNodeList->item(i);
-            CHECKNULL(extensionNode, L"MgServerSelectFeatures.FindFeatureJoinProperties");
+        STRING parsedSchemaName = L"";
+        STRING parsedExtensionName = L"";
+        ParseQualifiedClassName(extensionName, parsedSchemaName, parsedExtensionName);
 
-            DOMNodeList* nameNodeList = m_xmlUtil.GetNodeList(extensionNode, "Name");
-            int nNameNodes = (int)nameNodeList->getLength();
-
-            // get the extension name node
-            DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
-
-            // get the extension name value
-            STRING name;
-            m_xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, name);
-
-            STRING parsedSchemaName = L"";
-            STRING parsedExtensionName = L"";
-            ParseQualifiedClassName(extensionName, parsedSchemaName, parsedExtensionName);
-
-            if (parsedExtensionName != name)
-            {
-                continue;
-            }
-            else
-            {
-                bJoinPropertiesExists = true;
-            }
+        if (parsedExtensionName != name)
+        {
+            continue;
         }
+        else
+        {
+            bJoinPropertiesExists = true;
+        }
     }
 
     return bJoinPropertiesExists;
@@ -826,27 +817,17 @@
     FdoPtr<IGWSQueryDefinition> qd;
     FdoPtr<MgGwsConnectionPool> pool = MgGwsConnectionPool::Create();
 
-    DOMElement* rootNode = m_xmlUtil.GetRootNode();
-    DOMNodeList* extensionNodeList = m_xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
-    CHECKNULL(extensionNodeList, L"MgServerSelectFeatures.JoinFeatures");
+    CHECKNULL(m_featureSource, L"MgServerSelectFeatures.JoinFeatures");
 
-    int extensionNodes = (int)extensionNodeList->getLength();
+    MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+    CHECKNULL(extensions, L"MgServerSelectFeatures.JoinFeatures");
 
-    for (int i = 0; i < extensionNodes; i++)
+    for (int i = 0; i < extensions->GetCount(); i++)
     {
-        DOMNode* extensionNode = extensionNodeList->item(i);
-        CHECKNULL(extensionNode, L"MgServerSelectFeatures.JoinFeatures");
+        MdfModel::Extension* extension = extensions->GetAt(i);
+        CHECKNULL(extension, L"MgServerSelectFeatures.JoinFeatures");
+        STRING name = (STRING)extension->GetName();
 
-        DOMNodeList* nameNodeList = m_xmlUtil.GetNodeList(extensionNode, "Name");
-        int nNameNodes = (int)nameNodeList->getLength();
-
-        // get the extension name node
-        DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
-
-        // get the extension name value
-        STRING name;
-        m_xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, name);
-
         STRING parsedSchemaName = L"";
         STRING parsedExtensionName = L"";
         ParseQualifiedClassName(extensionName, parsedSchemaName, parsedExtensionName);
@@ -873,78 +854,64 @@
             }
 
             // Retrieve the primary feature class
-            wstring szFeatureClass;
-            m_xmlUtil.GetElementValue(extensionNode, "FeatureClass", szFeatureClass);
+            STRING featureClass = (STRING)extension->GetFeatureClass();
 
-            // Parse the qualified classname
+            // Parse the qualifed classname
             STRING primaryFsSchema = L"";
             STRING primaryFsClassName = L"";
-            ParseQualifiedClassName(szFeatureClass, primaryFsSchema, primaryFsClassName);
+            ParseQualifiedClassName(featureClass, primaryFsSchema, primaryFsClassName);
 
             // Create primary query definition
             FdoPtr<FdoStringCollection> lsellist;
             FdoPtr<FdoFilter> lfilter = FDO_SAFE_ADDREF(filter);
 
             FdoPtr<IGWSQueryDefinition> lqd = IGWSFeatureQueryDefinition::Create(
-                   lsellist,
-                   GWSQualifiedName(primaryConnectionName.c_str(), primaryFsSchema.c_str(), primaryFsClassName.c_str()),
-                   lfilter);
+                lsellist,
+                GWSQualifiedName(primaryConnectionName.c_str(), primaryFsSchema.c_str(), primaryFsClassName.c_str()),
+                lfilter);
             CHECKNULL(lqd, L"MgServerSelectFeatures.JoinFeatures");
             qd = lqd;
 
             IGWSJoinQueryDefinition* jqd = NULL;
 
-            // Determine the number of secondary sources (AttributeRelate nodes)
-            DOMNodeList* attributeRelateNodeList = m_xmlUtil.GetNodeList(extensionNode, "AttributeRelate");
-            int nAttributeRelateNodes = (int)attributeRelateNodeList->getLength();
+            MdfModel::AttributeRelateCollection* attributeRelates = extension->GetAttributeRelates();
+            CHECKNULL(attributeRelates, L"MgServerSelectFeatures.JoinFeatures");
 
-            // For each join to a secondary source need to do the following
             bool bForceOneToOne = true;
             Ptr<MgStringCollection> attributeNameDelimiters = new MgStringCollection();
-            for (int attributeRelateIndex = 0; attributeRelateIndex < nAttributeRelateNodes; attributeRelateIndex++)
+
+            // For each join (attributeRelate) to a secondary source need to do the following
+            for (int attributeRelateIndex = 0; attributeRelateIndex < attributeRelates->GetCount(); attributeRelateIndex++)
             {
-                DOMNode* attributeRelateNode = attributeRelateNodeList->item(attributeRelateIndex);
+                MdfModel::AttributeRelate* attributeRelate = attributeRelates->GetAt(attributeRelateIndex);
+                CHECKNULL(attributeRelate, L"MgServerSelectFeatures.JoinFeatures");
 
                 // Get the secondary resource id
-                wstring szSecondaryResourceId;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "ResourceId", szSecondaryResourceId);
+                STRING secondaryResourceId = (STRING)attributeRelate->GetResourceId();
 
                 // Get the name for the join relationship
-                wstring szAttributeRelateName;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "Name", szAttributeRelateName);
-                STRING secondaryConnectionName = szAttributeRelateName;
-
+                STRING attributeRelateName = (STRING)attributeRelate->GetName();
+                STRING secondaryConnectionName = attributeRelateName;
+    
                 // Get the RelateType (join type).  Default is Left Outer join.
-                wstring szRelateType;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "RelateType", szRelateType, false);
-                if (szRelateType.empty())
-                {
-                    szRelateType = L"LeftOuter";     // NOXLATE
-                }
+                MdfModel::AttributeRelate::RelateType relateType = attributeRelate->GetRelateType();
 
-                // Get the ForceOneToOne field, which specifies if multiple matching secondary features 
+                // Get the ForceOneToOne field, which specifies if multiple matching secondary features
                 // are retrieved via a 1-to-1 or 1-to-many relationship.  Default is 1-to-1 relationship.
-                wstring szForceOneToOne;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "ForceOneToOne", szForceOneToOne, false);
-                if (szForceOneToOne.empty())
+                bool forceOneToOne = attributeRelate->GetForceOneToOne();
+                // If there is at least one relation is defined as one-to-many, then the one-to-many result will apply to all join results. 
+                if (!forceOneToOne)
                 {
-                    szForceOneToOne = L"true";     // NOXLATE
-                }
-                // If there is at least one relation is defined as a one-to-many, then the one-to-many result will apply to all join results.
-                if (!MgUtil::StringToBoolean(szForceOneToOne))
-                {
                     bForceOneToOne = false;
                 }
 
                 // Get the AttributeNameDelimiter field, which specifies the delimiter between the JoinName (attribute relate name)
                 // and the property name for an extended property.  Default delimiter is "" (blank).
-                wstring szAttributeNameDelimiter;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "AttributeNameDelimiter", szAttributeNameDelimiter, false);
-                STRING attributeNameDelimiter = szAttributeNameDelimiter;
+                STRING attributeNameDelimiter = (STRING)attributeRelate->GetAttributeNameDelimiter();
                 attributeNameDelimiters->Add(attributeNameDelimiter);
 
                 // Establish connection to provider for secondary feature source
-                Ptr<MgResourceIdentifier> secondaryFeatureSource = new MgResourceIdentifier(szSecondaryResourceId);
+                Ptr<MgResourceIdentifier> secondaryFeatureSource = new MgResourceIdentifier(secondaryResourceId);
 
                 if (NULL != secondaryFeatureSource)
                 {
@@ -961,70 +928,69 @@
                     }
                 }
 
-                // Get the secondary feature className (qualified className)
-                wstring szSecondaryClassName;
-                m_xmlUtil.GetElementValue(attributeRelateNode, "AttributeClass", szSecondaryClassName);
+                // Get the secondary featureClassName (qualified className)
+                STRING secondaryClassName = (STRING)attributeRelate->GetAttributeClass();
 
-                // Parse the qualifed classname
+                // Parse the qualified classname
                 STRING secondaryFsSchema = L"";
                 STRING secondaryFsClassName = L"";
-                ParseQualifiedClassName(szSecondaryClassName, secondaryFsSchema, secondaryFsClassName);
+                ParseQualifiedClassName(secondaryClassName, secondaryFsSchema, secondaryFsClassName);
 
                 // Create secondary query definition
                 FdoPtr<FdoStringCollection> rsellist;
                 FdoPtr<FdoFilter> rfilter;
 
-                FdoPtr<IGWSQueryDefinition> rqd = IGWSFeatureQueryDefinition::Create(
-                       rsellist,
-                       GWSQualifiedName(secondaryConnectionName.c_str(), secondaryFsSchema.c_str(), secondaryFsClassName.c_str()),
-                       rfilter);
+                FdoPtr<IGWSQueryDefinition> rqd  = IGWSFeatureQueryDefinition::Create(
+                    rsellist,
+                    GWSQualifiedName(secondaryConnectionName.c_str(), secondaryFsSchema.c_str(), secondaryFsClassName.c_str()),
+                    rfilter);
                 CHECKNULL(rqd, L"MgServerSelectFeatures.JoinFeatures");
 
                 // Get Join Attributes
                 FdoPtr<FdoStringCollection> lattrs = FdoStringCollection::Create();
                 FdoPtr<FdoStringCollection> rattrs = FdoStringCollection::Create();
 
-                // Determine the number of ReleateProperties (attributes)
-                DOMNodeList* relatePropertyNodeList = m_xmlUtil.GetNodeList(attributeRelateNode, "RelateProperty");
-                int nRelatePropertyNodes = relatePropertyNodeList->getLength();
+                // Determine the number of RelateProperties (attributes)
+                MdfModel::RelatePropertyCollection* relateProperties = attributeRelate->GetRelateProperties();
+                CHECKNULL(relateProperties, L"MgServerSelectFeatures.JoinFeatures");
+                int nRelatePropertyCount = relateProperties->GetCount();
 
                 // For each RelateProperty need to do the following
-                for (int relatePropertyNodeIndex = 0; relatePropertyNodeIndex < nRelatePropertyNodes; relatePropertyNodeIndex++)
-                {
-                    DOMNode* relatePropertyNode = relatePropertyNodeList->item(relatePropertyNodeIndex);
+                for (int relatePropertyIndex = 0; relatePropertyIndex < nRelatePropertyCount; relatePropertyIndex++)
+                { 
+                    MdfModel::RelateProperty* relateProperty = relateProperties->GetAt(relatePropertyIndex);
+                    CHECKNULL(relateProperty, L"MgServerSelectFeatures.JoinFeatures");
 
                     // Get the FeatureClassProperty (primary attribute)
-                    wstring szPrimaryAttribute;
-                    m_xmlUtil.GetElementValue(relatePropertyNode, "FeatureClassProperty", szPrimaryAttribute);
+                    STRING primaryAttribute = (STRING)relateProperty->GetFeatureClassProperty();
 
                     // Add to the primary attribute String collection
-                    lattrs->Add(szPrimaryAttribute.c_str());
+                    lattrs->Add(primaryAttribute.c_str());
 
                     // Get the AttributeClassProperty (secondary attribute)
-                    wstring szSecondaryAttribute;
-                    m_xmlUtil.GetElementValue(relatePropertyNode, "AttributeClassProperty", szSecondaryAttribute);
+                    STRING secondaryAttribute = (STRING)relateProperty->GetAttributeClassProperty();
 
                     // Add to the secondary attribute String collection
-                    rattrs->Add(szSecondaryAttribute.c_str());
+                    rattrs->Add(secondaryAttribute.c_str());
                 }
 
                 // Create the QueryDefinition
                 if (NULL != rqd)
                 {
-                    FdoString* joinName = szAttributeRelateName.c_str();
+                    FdoString* joinName = attributeRelateName.c_str();
                     FdoString* joinDelimiter = L".";
-                    if (0 == szRelateType.compare(L"Inner"))     // NOXLATE
+                    if (MdfModel::AttributeRelate::Inner == relateType)
                     {
                         jqd = IGWSEqualJoinQueryDefinition::Create(joinName, joinDelimiter, bForceOneToOne, lqd, rqd, lattrs, rattrs);
                     }
-                    else   //if (0 == szRelateType.compare(L"LeftOuter"))
+                    else  // if (RelateType::LeftOuter == relateType)
                     {
                         jqd = IGWSLeftJoinQueryDefinition::Create(joinName, joinDelimiter, bForceOneToOne, lqd, rqd, lattrs, rattrs);
                     }
                     lqd = jqd;
                 }
 
-            } // Repeat for each secondary source
+            }  // Repeat for each secondary source
             qd = lqd;
 
             FdoPtr<IGWSQuery> query = IGWSQuery::Create(pool, qd, NULL);
@@ -1041,6 +1007,7 @@
             gwsFeatureReader = new MgServerGwsFeatureReader(iter, bForceOneToOne, attributeNameDelimiters);
             gwsFeatureReader->PrepareGwsGetFeatures(parsedExtensionName, fsNames);
             gwsFeatureReader->SetGwsIteratorCopy(iterCopy);
+
         }
     }
 
@@ -1061,6 +1028,12 @@
     {
          pFdoConnectionManager->RetrieveFeatureSource(resource, resourceContent);
     }
+
+    if (m_featureSource == NULL)
+    {
+        m_featureSource = GetFeatureSource(resource);
+    }
+
 }
 
 
@@ -1074,63 +1047,55 @@
 
 MgResourceIdentifier* MgServerSelectFeatures::GetSecondaryResourceIdentifier(MgResourceIdentifier* primResId, CREFSTRING extensionName, CREFSTRING relationName)
 {
+    CHECKNULL(m_featureSource, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
+
     Ptr<MgResourceIdentifier> secResId;
 
-    DOMElement* rootNode = m_xmlUtil.GetRootNode();
-    DOMNodeList* extensionNodeList = m_xmlUtil.GetNodeList(rootNode, "Extension" /* NOXLATE */ );
+    MdfModel::ExtensionCollection* extensions = m_featureSource->GetExtensions();
+    CHECKNULL(extensions, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
 
-    if (NULL != extensionNodeList)
+    for (int i = 0; i < extensions->GetCount(); i++)
     {
-        int extensionNodes = (int)extensionNodeList->getLength();
+        MdfModel::Extension* extension = extensions->GetAt(i);
+        CHECKNULL(extension, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
 
-        for (int i = 0; i < extensionNodes; i++)
-        {
-            DOMNode* extensionNode = extensionNodeList->item(i);
-            CHECKNULL(extensionNode, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
+        // Get the extension name
+        STRING name = (STRING)extension->GetName();
 
-            DOMNodeList* nameNodeList = m_xmlUtil.GetNodeList(extensionNode, "Name");
-            int nNameNodes = (int)nameNodeList->getLength();
+        STRING parsedSchemaName = L"";
+        STRING parsedExtensionName = L"";
+        ParseQualifiedClassName(extensionName, parsedSchemaName, parsedExtensionName);
 
-            // get the extension name node
-            DOMNode* extensionNameNode = nameNodeList->item(nNameNodes - 1);
+        if (parsedExtensionName != name)
+        {
+            continue;
+        }
+        else
+        {
+            // Determine the number of secondary sources (AttributeRelates)
+            MdfModel::AttributeRelateCollection* attributeRelates = extension->GetAttributeRelates();
+            CHECKNULL(attributeRelates, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
+            int nAttributeRelateCount = attributeRelates->GetCount();
 
-            // get the extension name value
-            STRING name;
-            m_xmlUtil.GetTextFromElement((DOMElement*)extensionNameNode, name);
-
-            STRING parsedSchemaName = L"";
-            STRING parsedExtensionName = L"";
-            ParseQualifiedClassName(extensionName, parsedSchemaName, parsedExtensionName);
-
-            if (parsedExtensionName != name)
+            // Find the specified relation name
             {
-                continue;
-            }
-            else
-            {
-                // Determine the number of secondary sources (AttributeRelate nodes)
-                DOMNodeList* attributeRelateNodeList = m_xmlUtil.GetNodeList(extensionNode, "AttributeRelate");
-                int nAttributeRelateNodes = (int)attributeRelateNodeList->getLength();
-
-                // Find the the specified relation name
-                for (int attributeRelateIndex = 0; attributeRelateIndex < nAttributeRelateNodes; attributeRelateIndex++)
+                for (int attributeRelateIndex = 0; attributeRelateIndex < nAttributeRelateCount; attributeRelateIndex++)
                 {
-                    DOMNode* attributeRelateNode = attributeRelateNodeList->item(attributeRelateIndex);
+                    MdfModel::AttributeRelate* attributeRelate = attributeRelates->GetAt(attributeRelateIndex);
+                    CHECKNULL(attributeRelate, L"MgServerSelectFeatures.GetSecondaryResourceIdentifier");
 
                     // Get the name for the join relationship
-                    wstring szAttributeRelateName;
-                    m_xmlUtil.GetElementValue(attributeRelateNode, "Name", szAttributeRelateName);
+                    STRING attributeRelateName = (STRING)attributeRelate->GetName();
 
-                    if ( szAttributeRelateName != relationName )
+                    if (attributeRelateName != relationName)
                     {
                         continue;
                     }
                     else
                     {
                         // Get the secondary resource id
-                        wstring szSecondaryResourceId;
-                        m_xmlUtil.GetElementValue(attributeRelateNode, "ResourceId", szSecondaryResourceId);
-                        secResId = new MgResourceIdentifier(szSecondaryResourceId);
+                        STRING secondaryResourceId = (STRING)attributeRelate->GetResourceId();
+                        secResId = new MgResourceIdentifier(secondaryResourceId);
                         break;
                     }
                 }
@@ -1141,3 +1106,19 @@
     return secResId.Detach();
 }
 
+MdfModel::FeatureSource* MgServerSelectFeatures::GetFeatureSource(MgResourceIdentifier* resource)
+{
+    CHECKNULL(resource, L"MgServerSelectFeatures.GetFeatureSource");
+
+    MdfModel::FeatureSource* fs = NULL;
+
+    // Get the feature source XML content document from the FDO connection manager.
+    MgFdoConnectionManager* pFdoConnectionManager = MgFdoConnectionManager::GetInstance();
+    if(pFdoConnectionManager)
+    {
+         fs = pFdoConnectionManager->GetFeatureSource(resource);
+    }
+
+    assert (fs != NULL);
+    return fs;
+}

Modified: trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.h	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Feature/ServerSelectFeatures.h	2007-01-29 06:38:33 UTC (rev 1076)
@@ -70,8 +70,9 @@
     Ptr<MgFeatureQueryOptions> m_options;
     STRING                  filterText;
     Ptr<MgFeatureServiceCommand>    m_command;
-    MgXmlUtil m_xmlUtil;
 
+    MdfModel::FeatureSource* m_featureSource;
+
     // Only one custom property is supported. No nesting of custom properties allowed.
     STRING                  m_customPropertyName;
     bool                    m_customPropertyFound;
@@ -83,6 +84,8 @@
     void RetrieveFeatureSource(MgResourceIdentifier* resource, string& resourceContent);
     void ParseQualifiedClassName(CREFSTRING qualifiedClassName, STRING& schemaName, STRING& className);
     MgResourceIdentifier* GetSecondaryResourceIdentifier(MgResourceIdentifier* primResId, CREFSTRING extensionName, CREFSTRING relationName);
+
+    MdfModel::FeatureSource* GetFeatureSource(MgResourceIdentifier* resource);
 };
 
 #endif

Modified: trunk/MgDev/Server/src/Services/Resource/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/Makefile.am	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Resource/Makefile.am	2007-01-29 06:38:33 UTC (rev 1076)
@@ -17,6 +17,8 @@
   -I../../../../Common/Geometry \
   -I../../../../Common/PlatformBase \
   -I../../../../Common/MapGuideCommon \
+  -I../../../../Common/MdfModel \
+  -I../../../../Common/MdfParser \
   -I../../Common \
   -I../../Common/Base \
   -I../../Common/Manager \

Modified: trunk/MgDev/Server/src/Services/Resource/ServerResourceService.vcproj
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ServerResourceService.vcproj	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/Services/Resource/ServerResourceService.vcproj	2007-01-29 06:38:33 UTC (rev 1076)
@@ -41,7 +41,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\db-4.3.29\build_win32&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\include&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\src&quot;;..\..\..\..\Oem\DWFTK7.1\develop\global\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Common\;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\Feature;..\Site"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\db-4.3.29\build_win32&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\include&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\src&quot;;..\..\..\..\Oem\DWFTK7.1\develop\global\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\Common\;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\Feature;..\Site"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_RESOURCE_EXPORTS;DWFCORE_STATIC;DWFTK_USE_DWFCORE_ZLIB"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
@@ -123,7 +123,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\db-4.3.29\build_win32&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\include&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\src&quot;;..\..\..\..\Oem\DWFTK7.1\develop\global\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\Common\;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\Feature;..\Site"
+				AdditionalIncludeDirectories="..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\db-4.3.29\build_win32&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\include&quot;;&quot;..\..\..\..\Oem\dbxml-2.2.13\dbxml\src&quot;;..\..\..\..\Oem\DWFTK7.1\develop\global\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Common\CoordinateSystem;..\..\..\..\Common\Security;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\Common\;..\..\Common\Base;..\..\Common\Manager;..\..\Common\ServerUtil;..\Feature;..\Site"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_SERVER_RESOURCE_EXPORTS;DWFCORE_STATIC;DWFTK_USE_DWFCORE_ZLIB"
 				ExceptionHandling="2"
 				RuntimeLibrary="2"

Modified: trunk/MgDev/Server/src/UnitTesting/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/Makefile.am	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/UnitTesting/Makefile.am	2007-01-29 06:38:33 UTC (rev 1076)
@@ -7,10 +7,13 @@
 INCLUDES = \
   -I../../../Oem/ACE/ACE_wrappers \
   -I../../../Oem/CppUnit-1.9.14/include \
+  -I../../../Oem/dbxml-2.2.13/xerces-c-src/src \
   -I../../../Common/Foundation \
   -I../../../Common/Geometry \
   -I../../../Common/PlatformBase \
   -I../../../Common/MapGuideCommon \
+  -I../../../Common/MdfModel \
+  -I../../../Common/MdfParser \
   -I../Common \
   -I../Common/Manager \
   -I../Services/Feature \

Modified: trunk/MgDev/Server/src/UnitTesting/UnitTesting.vcproj
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/UnitTesting.vcproj	2007-01-27 00:26:59 UTC (rev 1075)
+++ trunk/MgDev/Server/src/UnitTesting/UnitTesting.vcproj	2007-01-29 06:38:33 UTC (rev 1076)
@@ -41,7 +41,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\CppUnit-1.9.14\include&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Manager;..\Services;..\Services\Feature;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile"
+				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\CppUnit-1.9.14\include&quot;;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Common\MdfModel;..\..\..\Common\MdfParser;..\Common;..\Common\Manager;..\Services;..\Services\Feature;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
 				MinimalRebuild="true"
 				ExceptionHandling="2"
@@ -123,7 +123,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\CppUnit-1.9.14\include&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\Common;..\Common\Manager;..\Services;..\Services\Feature;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile"
+				AdditionalIncludeDirectories="..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\Oem\CppUnit-1.9.14\include&quot;;&quot;..\..\..\Oem\dbxml-2.2.13\xerces-c-src\src&quot;;..\..\..\Oem\FDO\inc;..\..\..\Common\CoordinateSystem;..\..\..\Common\Foundation;..\..\..\Common\Geometry;..\..\..\Common\PlatformBase;..\..\..\Common\MapGuideCommon;..\..\..\Common\MdfModel;..\..\..\Common\MdfParser;..\Common;..\Common\Manager;..\Services;..\Services\Feature;..\Services\Mapping;..\Services\Rendering;..\Services\Resource;..\Services\ServerAdmin;..\Services\Site;..\Services\Tile"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
 				ExceptionHandling="2"
 				RuntimeLibrary="2"



More information about the mapguide-commits mailing list