Re: [mapguide-users] XML Parser error for Feature Sources
Thats works great. I had written a web app which allows a user to completely customise the appearances of layers. Behind the scenes it just edits the xml but I suspect the MaestroAPI could do this all for me without me touching the xml. I need to look into it more as I need to be able to save to both session and library and always show the updates on a live map however the MaestroAPI looks ideal. The help chm file, I can download fine but when I do, any links I try and open just come up with 'The address is not valid'. However turns out this is an intended security feature of IE. Basically to fix it all you have to do is right click on the chm file, go to properties and then click Unblock and it works. (Just in case anyone else has had the same issue) Thanks for all your help! Colin Kenneth Skovhede, GEOGRAF A/S wrote: You have to initialize the parameter collection manually: fs.Parameter = new MaestroAPI.NameValuePairTypeCollection(); (I forgot to mention that). I just tried to download MaestroAPI.chm, and the link works for me: http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Documentation/Msdn-Chm/MaestroAPI.chm?format=raw Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: I tried your example and I always get an error of: Object reference not set to an instance of an object. when I do: fs.Parameter[DefaultFilePath] = C:\my.shp; or other similar attempts for other providers. If I take this line out it creates the resource no problem. Do you know why this would happen? Also I tried to download the help (MaestroAPI.chm) off the website but none of the help links work. Have I done something daft? Any help is appreciated. Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users -- View this message in context: http://www.nabble.com/XML-Parser-error-for-Feature-Sources-tp20770245p20787959.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
RE: [mapguide-users] XML Parser error for Feature Sources
Thanks for the tip about Maestro chm file. I had the same problems until I 'Unblocked' the file just now.! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of cagray Sent: Tuesday, December 02, 2008 1:29 AM To: mapguide-users@lists.osgeo.org Subject: Re: [mapguide-users] XML Parser error for Feature Sources Thats works great. I had written a web app which allows a user to completely customise the appearances of layers. Behind the scenes it just edits the xml but I suspect the MaestroAPI could do this all for me without me touching the xml. I need to look into it more as I need to be able to save to both session and library and always show the updates on a live map however the MaestroAPI looks ideal. The help chm file, I can download fine but when I do, any links I try and open just come up with 'The address is not valid'. However turns out this is an intended security feature of IE. Basically to fix it all you have to do is right click on the chm file, go to properties and then click Unblock and it works. (Just in case anyone else has had the same issue) Thanks for all your help! Colin Kenneth Skovhede, GEOGRAF A/S wrote: You have to initialize the parameter collection manually: fs.Parameter = new MaestroAPI.NameValuePairTypeCollection(); (I forgot to mention that). I just tried to download MaestroAPI.chm, and the link works for me: http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Do cumentation/Msdn-Chm/MaestroAPI.chm?format=raw Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: I tried your example and I always get an error of: Object reference not set to an instance of an object. when I do: fs.Parameter[DefaultFilePath] = C:\my.shp; or other similar attempts for other providers. If I take this line out it creates the resource no problem. Do you know why this would happen? Also I tried to download the help (MaestroAPI.chm) off the website but none of the help links work. Have I done something daft? Any help is appreciated. Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users -- View this message in context: http://www.nabble.com/XML-Parser-error-for-Feature-Sources-tp20770245p20 787959.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users Notice Regarding Confidentiality This email, including any and all attachments, (this Email) is intended only for the party to whom it is addressed and may contain information that is confidential or privileged. Sierra Systems Group Inc. and its affiliates accept no responsibility for any loss
Re: [mapguide-users] XML Parser error for Feature Sources
I have now added a small note on the page hinting the solution. Regards, Kenneth Skovhede, GEOGRAF A/S Greenhough, Jamie skrev: Thanks for the tip about Maestro chm file. I had the same problems until I 'Unblocked' the file just now.! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of cagray Sent: Tuesday, December 02, 2008 1:29 AM To: mapguide-users@lists.osgeo.org Subject: Re: [mapguide-users] XML Parser error for Feature Sources Thats works great. I had written a web app which allows a user to completely customise the appearances of layers. Behind the scenes it just edits the xml but I suspect the MaestroAPI could do this all for me without me touching the xml. I need to look into it more as I need to be able to save to both session and library and always show the updates on a live map however the MaestroAPI looks ideal. The help chm file, I can download fine but when I do, any links I try and open just come up with 'The address is not valid'. However turns out this is an intended security feature of IE. Basically to fix it all you have to do is right click on the chm file, go to properties and then click Unblock and it works. (Just in case anyone else has had the same issue) Thanks for all your help! Colin Kenneth Skovhede, GEOGRAF A/S wrote: You have to initialize the parameter collection manually: fs.Parameter = new MaestroAPI.NameValuePairTypeCollection(); (I forgot to mention that). I just tried to download MaestroAPI.chm, and the link works for me: http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Do cumentation/Msdn-Chm/MaestroAPI.chm?format=raw Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: I tried your example and I always get an error of: Object reference not set to an instance of an object. when I do: fs.Parameter[DefaultFilePath] = C:\my.shp; or other similar attempts for other providers. If I take this line out it creates the resource no problem. Do you know why this would happen? Also I tried to download the help (MaestroAPI.chm) off the website but none of the help links work. Have I done something daft? Any help is appreciated. Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] XML Parser error for Feature Sources
Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S -- View this message in context: http://www.nabble.com/XML-Parser-error-for-Feature-Sources-tp20770245p20771868.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] XML Parser error for Feature Sources
The error in the log is: Error: An exception occurred in the XML parser. StackTrace: - MgResourceServiceHandler.ProcessOperation line 80 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceServiceHandler.cpp - MgOpSetResource.Execute line 103 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\OpSetResource.cpp - MgServerResourceService.SetResource line 713 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ServerResourceService.cpp - MgRepositoryManager.SetResource line 867 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\RepositoryManager.cpp - MgRepositoryManager.AddResource line 840 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\RepositoryManager.cpp - MgResourceContentManager.AddResource line 183 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceContentManager.cpp - MgResourceContentManager.PutDocument line 624 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceContentManager.cpp - MgResourceDefinitionManager.PutDocument line 554 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceDefinitionManager.cpp - MgResourceDefinitionManager.ValidateDocument line 429 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceDefinitionManager.cpp - MgResourceContentManager.ValidateDocument line 556 file d:\build\mapguide_open_source_v2.0\build_30.11\mgdev\server\src\services\resource\ResourceContentManager.cpp An exception occurred in the XML parser. However the MaestroAPI looks really good (think i was confusing MaestroAPI with MapGuideAPI!). I'll have a go at that also. Many thanks again Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S -- View this message in context: http://www.nabble.com/XML-Parser-error-for-Feature-Sources-tp20770245p20772530.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] XML Parser error for Feature Sources
I tried your example and I always get an error of: Object reference not set to an instance of an object. when I do: fs.Parameter[DefaultFilePath] = C:\my.shp; or other similar attempts for other providers. If I take this line out it creates the resource no problem. Do you know why this would happen? Also I tried to download the help (MaestroAPI.chm) off the website but none of the help links work. Have I done something daft? Any help is appreciated. Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users -- View this message in context: http://www.nabble.com/XML-Parser-error-for-Feature-Sources-tp20770245p20774513.html Sent from the MapGuide Users mailing list archive at Nabble.com. ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] XML Parser error for Feature Sources
You have to initialize the parameter collection manually: fs.Parameter = new MaestroAPI.NameValuePairTypeCollection(); (I forgot to mention that). I just tried to download MaestroAPI.chm, and the link works for me: http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Documentation/Msdn-Chm/MaestroAPI.chm?format=raw Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: I tried your example and I always get an error of: Object reference not set to an instance of an object. when I do: fs.Parameter[DefaultFilePath] = C:\my.shp; or other similar attempts for other providers. If I take this line out it creates the resource no problem. Do you know why this would happen? Also I tried to download the help (MaestroAPI.chm) off the website but none of the help links work. Have I done something daft? Any help is appreciated. Colin Kenneth Skovhede, GEOGRAF A/S wrote: Yes, you can do just that. Look in the Maestro source code to see how it's done. The files ResourceEditors/ResourceEditorBase.cs and ResourceEditors/ResourceEditorGeneric.cs shows it. Some more customized versions are avalible in eg FeatureSourceEditorSDF.cs Basically you can do: MaestroAPI.ServerConnectionI con; //You must initialize this, see the developer docs MaestroAPI.FeatureSource fs = new MaestroAPI.FeatureSource(); fs.Provider = OSGeo.SHP.3.1; fs.Parameter[DefaultFilePath] = C:\my.shp; con.SaveResourceAs(fs, new MaestroAPI.ResourceIdentifier(my fs, OSGeo.MapGuide.MaestroAPI.ResourceTypes.FeatureSource)); As for your actual problem, does the server error log show anything? C:\program files\Mapguideopensource2.0\server\logs\error.log Regards, Kenneth Skovhede, GEOGRAF A/S cagray skrev: Thanks for the reply. Unfortunately that did not solve my problem and I got the same error. Is there anything else I could try? I was not aware you could do this without generating/manipulating the xml. My web tool has to fully control setting up data sources. So the user selects a provider and then fills in the connection details. I then need to create a new data source from this to be stored in mapguide. Can you do this using the Meastro API alone? Kenneth Skovhede, GEOGRAF A/S wrote: I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8 BOM, which causes problems in the Xml parser: http://trac.osgeo.org/mapguide/ticket/233 You can try to create the UTF-8 encoder with: UTF8Encoding utf8 = new UTF8Encoding(false); And see if the problem goes away. Alternatively you can use the MaestroAPI instead of messing with the raw Xml: http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI Regards, Kenneth Skovhede, GEOGRAF A/S ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users ___ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users