<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-2" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I have now added a small note on the page hinting the solution.<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Greenhough, Jamie skrev:
<blockquote
cite="mid:0FB387BEC450E54795983A68276C727C8FB720@SCVANEX5.sierrasys.com"
type="cite">
<pre wrap="">Thanks for the tip about Maestro chm file. I had the same problems until
I 'Unblocked' the file just now.!
-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a class="moz-txt-link-freetext" href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>] On Behalf Of cagray
Sent: Tuesday, December 02, 2008 1:29 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
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:
</pre>
<blockquote type="cite">
<pre wrap="">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:
</pre>
</blockquote>
<pre wrap=""><!----><a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Do">http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Do</a>
cumentation/Msdn-Chm/MaestroAPI.chm?format=raw
</pre>
<blockquote type="cite">
<pre wrap="">Regards, Kenneth Skovhede, GEOGRAF A/S
cagray skrev:
</pre>
<blockquote type="cite">
<pre wrap="">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
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->out it
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">creates the resource no problem. Do you know why this would happen?
Also I tried to download the help (MaestroAPI.chm) off the website
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->but
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">none
of the help links work. Have I done something daft?
Any help is appreciated.
Colin
Kenneth Skovhede, GEOGRAF A/S wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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,
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->see
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">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
</pre>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->fs",
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">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:
</pre>
<blockquote type="cite">
<pre wrap="">Thanks for the reply. Unfortunately that did not solve my problem
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->and I
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">got
the same error. Is there anything else I could try?
I was not aware you could do this without generating/manipulating
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->the
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">xml.
My web tool has to fully control setting up data sources. So the
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->user
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">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
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->you do
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">this
using the Meastro API alone?
Kenneth Skovhede, GEOGRAF A/S wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I believe the problem is the .Net UTF-8 Encoder prefixes an UTF-8
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->BOM,
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">which causes problems in the Xml parser:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/ticket/233">http://trac.osgeo.org/mapguide/ticket/233</a>
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
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
<pre wrap=""><!---->the
</pre>
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">raw
Xml:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI</a>
Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
</blockquote>
</blockquote>
<pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
<pre wrap="">
</pre>
</blockquote>
<pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>