[mapguide-users] Finding list of Mapdefinitions

Chris Gountanis cgountanis at mpower-tech.com
Wed Dec 13 15:24:43 EST 2006


When I do:
 
MgByteReader byteReader =
resourceService.EnumerateResources(resId,-1,MgResourceType.MapDefinition);
String xml = byteReader.ToString();
 
 
All I get in the string is a value of
"org.osgeo.mapguide.MgByteReader at b0fa61". Any ideas on why?
 
--
Chris

 

  _____  

From: Dave Wilson [mailto:dave.wilson at autodesk.com] 
Sent: Tuesday, December 12, 2006 5:21 PM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] Finding list of Mapdefinitions


Thanks Scott. Beat me to it.
 
With the DOM parser you can search on the <ResourceId> tag and parse the
name of the map, here's an example value:
 
<ResourceId>Library://QE_Data/Maps/SDF2.0_Dublin_CA83IIIF.MapDefinition</Res
ourceId>
 
By the way it's Library://
 
// and not \\ just in case you missed that too.
 
Dave

  _____  

From: Scott Reisdorf [mailto:reisdorf1 at llnl.gov] 
Sent: Tuesday, December 12, 2006 4:18 PM
To: users at mapguide.osgeo.org
Subject: Re: [mapguide-users] Finding list of Mapdefinitions


In Java you can do something like this, creating a ByteArrayOutputStream and
then displaying that stream back as a String.


 ByteArrayOutputStream bos = new ByteArrayOutputStream();        
        byte[] byteBuffer = new byte[1024];
        int numBytes = byteReader.Read(byteBuffer, 1024);
        while(numBytes > 0)
        {
            bos.write(byteBuffer, 0, numBytes);
            numBytes = byteReader.Read(byteBuffer, 1024);
        }
        System.out.println(bos.toByteArray());


or you can get straight XML back from the MgByteReader, and then parse that:

  MgByteReader byteReader =
resourceService.EnumerateResources(resId,-1,MgResourceType.MapDefinition);
        String xml = byteReader.ToString();
   //  ...parse the xml via the DOM

hope this helps
-scott

Scott Hameister wrote: 

Did that, but I get an MgByteReader object with no clue how to iterate.isn't
there a count/getitem method I could use or do I have to convert to a string
and Parse or something?






  _____  


From: Dave Wilson [mailto:dave.wilson at autodesk.com] 
Sent: Tuesday, December 12, 2006 4:54 PM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] Finding list of Mapdefinitions



Try MapDefinition



Case sensitive.



:)


  _____  


From: Scott Hameister [mailto:ScottH at mPower-tech.com] 
Sent: Tuesday, December 12, 2006 3:53 PM
To: users at mapguide.osgeo.org
Subject: [mapguide-users] Finding list of Mapdefinitions

Pulling my Hair out I'm just trying to get a list of Mapdefinitions in the
Library:\\



I tried doing EnumerateResources on Library\\: with -1 and Mapdefinition,
but can't find an API way to get the names..Am I way off target here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20061213/f3ef748a/attachment.html


More information about the Mapguide-users mailing list