<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
If that file is missing, you should not be able to save any weblayout,<br>
no matter what, so I think it is correctly avalible.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
euskalmap skrev:
<blockquote cite="mid:1237478575227-2503776.post@n2.nabble.com"
 type="cite">
  <pre wrap="">Hi,
It seems that MapguideServer do not acceded at directory C:/Program
Files/MapGuideOpenSource2.0/Server/Schema/; so, it do not find the file
WebLayouy-1.0.0.xsd schema?

What you think about it?


euskalmap wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">ERROR:
The instruction
    String xmlString = doc.DocumentElement.OuterXml;
DO NOT remove the preamble. But i thought that OuterXml remove the first
tag.
Sorry for my error


euskalmap wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">When i load the xml with this instruction : 
    XmlDocument doc = new XmlDocument();
   String xmlLayoutDef = byteReader.ToString();
there is the preamble &lt;?xml version="1.0" encoding="utf-8"?&gt;
Later, the instruction
    String xmlString = doc.DocumentElement.OuterXml;
remove the preamble.
Other information : if i load the file 
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Untitled1.xml">http://patxi.mayol.free.fr/Untitled1.xml</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Untitled1.xml">http://patxi.mayol.free.fr/Untitled1.xml</a>  in an editor XML like altova,
for example, i have this message when i want to save it : This file is
not valid: Unable to load schema with target namespace " from
'WebLayout-1.0.0.xsd''.
So, is this instruction String xmlString = doc.DocumentElement.OuterXml;
bad ? I have find in sample on the forum?

What you think about it?.
Thanks

Kenneth Skovhede, GEOGRAF A/S wrote:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Ok, that file does not have the preamble (the "&lt;?xml version=\"1.0\" 
encoding=\"utf-8\"?&gt;" string).
Not sure if it fixes your problem if you add it, but its worth a try.

The line mentioned seems to only check that the first element 
(WebLayout) matches the xsd file (WebLayout).

I wrote about the doublequote, because there was a line with:
char doublequote = (char)34;
which works, but is not very intuitive and suggests that someone did not 
know how to escape doublequotes.

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
        </pre>
        <blockquote type="cite">
          <pre wrap="">I have do 
  using(System.IO.FileStream fs = System.IO.File.Create("test.xml"))
  fs.Write(encodedDefinition, 0, encodedDefinition.Length);

The result is here :  <a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/test.xml">http://patxi.mayol.free.fr/test.xml</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/test.xml">http://patxi.mayol.free.fr/test.xml</a> 

How know that my document have the utf-8 xml preamble ?

About the string "xmlns=\"namespace\"", i have not this in my xml file.
Thanks



Kenneth Skovhede, GEOGRAF A/S wrote:
  
          </pre>
          <blockquote type="cite">
            <pre wrap="">I'm am a bit puzzled by this:

String xmlString = doc.DocumentElement.OuterXml; 
...
"After modif = \ n "+"&lt;? xml version ='1 .0 'encoding =' UTF-8'?&gt;"+
xmlString

It seems that the xmlString is missing the xml preamble?
Just to clarify: the document MUST have the utf-8 xml preamble, and
MUST 
NOT have the utf-8 BOM.

The file you sent does not appear to be made from the encoded data.
You must do something like:
using(System.IO.FileStream fs = System.IO.File.Create("test.xml"))
  fs.Write(encodedDefinition, 0, encodedDefinition.Length);

Otherwise there are too many places that can introduce small
differences.

btw, in C#, you can make a string with quotes like this:
"xmlns=\"namespace\""
or
@"xmlns=""namespace""" //VB style

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
            </pre>
            <blockquote type="cite">
              <pre wrap="">The file is generate in my code after the instruction
'resourceSrvc.SetResource(webLayoutId, contentByteSource.GetReader(),
null);' So, i do not understand why the file is fine and my
mapdefinition
in
my layout generate the error An exception occurred in the XML parser.

If you have few minutes you can see the trace of my function
ag_SetLayoutMap
here :  <a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Trace.htm">http://patxi.mayol.free.fr/Trace.htm</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Trace.htm">http://patxi.mayol.free.fr/Trace.htm</a> 
and a sample of my C# code here : 
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/sample.asp">http://patxi.mayol.free.fr/sample.asp</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/sample.asp">http://patxi.mayol.free.fr/sample.asp</a> , who is describe the
ag_SetLayoutMap
function.
thanks
regards, Francis

Kenneth Skovhede, GEOGRAF A/S wrote:
  
      
              </pre>
              <blockquote type="cite">
                <pre wrap="">Is this a question?

The un-edited file loads fine for me.

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        
                </pre>
                <blockquote type="cite">
                  <pre wrap="">Hi,
I have not send the good link of my file; in the previous version ,
i
have
trying to delete in the xml the string
"xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd".
So, my file is :  <a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Untitled1.xml">http://patxi.mayol.free.fr/Untitled1.xml</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/Untitled1.xml">http://patxi.mayol.free.fr/Untitled1.xml</a> 

So i test GetResourceContent rather than SetResource : 
If i try  <a class="moz-txt-link-freetext" href="http://localhost/mapguide/mapagent/index.html">http://localhost/mapguide/mapagent/index.html</a>
<a class="moz-txt-link-freetext" href="http://localhost/mapguide/mapagent/index.html">http://localhost/mapguide/mapagent/index.html</a>  with
GetResourceContent
on
"Library://Ag Base/Mpg Urbanisme.WebLayout" and submit, i have this
result : 

<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n2490672/test.jpg">http://n2.nabble.com/file/n2490672/test.jpg</a> 

The message in header, in french, is in english : This file XML
does
not
seem to have of information of style associated with him. The tree
of
the
document is shown below.

SO

Kenneth Skovhede, GEOGRAF A/S wrote:
  
      
          
                  </pre>
                  <blockquote type="cite">
                    <pre wrap="">A bit tricky, something to do with how .Net handles Xml I think.

The document is missing the attribute:
xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd"

Which is required, because it is used for versioning and
validation.
If you take your document and open this page:
<a class="moz-txt-link-freetext" href="http://localhost/mapguide/mapagent/index.html">http://localhost/mapguide/mapagent/index.html</a>

Then click "Resource" -&gt; "SetResource", point out the file,
and in the "ResourceID" field type: "Library://mytest.WebLayout".

Then set the "Content" field to point to the file and click
submit.
You will see the error you mention.

Now add the above attribute, so the second line in the document
becomes:
&lt;WebLayout xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a> 
xmlns:xsd=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a> 
xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd"&gt;

Save the document, click back in the browser, and then "Submit"
once
more.
This time it works. (Remember to check that the ResourceID and
Content 
field has not been reset).

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        
            
                    </pre>
                    <blockquote type="cite">
                      <pre wrap="">Hi,
Yes, i have see the log file, but there is no more information
that
'XML
Parser error'.
The logfile is :
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n2474100/logfile.jpg">http://n2.nabble.com/file/n2474100/logfile.jpg</a> 

About the XML file, after modification i have this file : 
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/mytest.xml">http://patxi.mayol.free.fr/mytest.xml</a>
<a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/mytest.xml">http://patxi.mayol.free.fr/mytest.xml</a> 



Thanks
regards


Kenneth Skovhede, GEOGRAF A/S wrote:
  
      
          
              
                      </pre>
                      <blockquote type="cite">
                        <pre wrap="">Did you look in the error.log file?
Could you try to save the xml document after modification, and
send

link to it?

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        
            
                
                        </pre>
                        <blockquote type="cite">
                          <pre wrap="">Hi,
In fact, before modification, i have 
MgResourceIdentifier webLayoutId = new
MgResourceIdentifier(pst_weblayout) 
with pst_weblayout = "Library://Ag Base/MyLayout.WebLayout" 
I search the xml node for modify Mapdefinition resource and 
after modification i have in instruction 
webLayoutId = new MgResourceIdentifier(str_NewMapDefinition) 
with
str_NewMapDefinition=Session:xxxxxxxxx//MyMap.MapDefinition
So, i set the resource and i have the message 'An exception
occurred
in
the
XML parser.'
I say it is simply to migrate vb to c#, but before i want to
understand.
I have use same sample who use this method on the forum; but i
do
not
explain where is my bug?
thanks a lot for your help


Kenneth Skovhede, GEOGRAF A/S wrote:
  
      
          
              
                  
                          </pre>
                          <blockquote type="cite">
                            <pre wrap="">It is very trivial to convert the sample to C#... in fact I
just
did:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout</a>

If you just want to understand what happens, there should be a
more 
verbose message in the error.log:
C:\Program Files\MapGuideOpenSource2.0\Server\logs\error.log

Also, are you certain that the pst_map is a valid map
identifier,
and 
that str_NewMapDefinition is a valid resource identifier?

I'm guessing that pst_map is a string like: 
"Library://map.MapDefinition", so your str_NewMapDefinition
becomes:
Session:&lt;sessionid&gt;//Library://map.MapDefinition.MapDefinition

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        
            
                
                    
                            </pre>
                            <blockquote type="cite">
                              <pre wrap="">Hi,
It do not run with the parameter false in the instruction
UTF8Encoding
utf8
= new UTF8Encoding(false);
In your link sample(
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout</a>
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout</a>
), it is a vb code with the mapguide maetro api; i will not
change
all
my
code because i use c# with mapguide api; i want to undestand
why
it
do
not
run; i use the same method to change the filter in layers and
it
run
very
well ! what's append in my code?

thanks

Kenneth Skovhede, GEOGRAF A/S wrote:
  
      
          
              
                  
                      
                              </pre>
                              <blockquote type="cite">
                                <pre wrap="">You need to create the UTF8Encoding object with the
parameter
"false" 
(meaning disable BOM).

A slightly easier way to do this:
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/CustomizedZoomWithWebLayout</a>

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        
            
                
                    
                        
                                </pre>
                                <blockquote type="cite">
                                  <pre wrap="">Hi
I provide the end user with a link to my special page (see
the
code1).
In
that page i redirect to the MapGuide viewer files
(Response.Redirect).
code1:
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n2462320/sample1.jpg">http://n2.nabble.com/file/n2462320/sample1.jpg</a> 
The fonction SetLayout Map modify the mapdefinition in my
layout.
See
image
here :
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n2462320/sample2.jpg">http://n2.nabble.com/file/n2462320/sample2.jpg</a> 
The problem : the layout is not modify and i have this
message
:
An
exception occurred in the XML parser.
Have you an idea ?
Thanks

  
      
          
              
                  
                      
                          
                                  </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>
                            <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>
                    <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>
            <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>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>