[mapguide-users] Finding list of Mapdefinitions
Jason Birch
Jason.Birch at nanaimo.ca
Tue Dec 12 19:02:16 EST 2006
Or you could hit the MapAgent :)
http://localhost:8008/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERAT
ERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library://&TYPE=MapDefinit
ion&DEPTH=-1
Parsing the DOM isn't that hard in PHP (stealing from Bob's excellent AU
session on resources):
$resourceDOC = DOMDocument::loadXML($byteReader->ToString());
$mapList = $resourceDOC->getElementsByTagName('ResourceId');
foreach ($mapList as $map)
{
print $map->nodeValue;
}
Jason
________________________________
From: Scott Reisdorf
Sent: Tuesday, December 12, 2006 15:18
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
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/20061212/5924cf6a/attachment.html
More information about the Mapguide-users
mailing list