• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# XML? PGML?

## Recommended Posts

Hello All, Well, I am thinking about laying the levels of my game in XML, I just started tinkering with XML and so far, I think it could be useful for my purposes. Now, I am thinking. . . it would be great to be able to visualize the level in a browser with simple graphics, so I start looking for a way to do this, I first stumbled across VML, then I found it only works in IE, I am a Mozilla user, so I forget about that, and keep looking. I came to find PGML (Presision Graphics Markup Language), I checked the W3C site and found an example:
<?xml version="1.0"?>
<!DOCTYPE pgml SYSTEM "pgml.dtd">
<pgml>
<group fillcolor="red">
<rectangle x="100" y="100" width="100" height="100" />
<rectangle x="300" y="100" width="100" height="100" />
</group>
<group fillcolor="blue">
<rectangle x="100" y="300" width="100" height="100" />
<rectangle x="300" y="300" width="100" height="100" />
</group>
</pgml>

I copied and pasted that into a .xml file, and tried to open it with Mozilla, opened just as any xml file with no DTD, so I tried IE, and it tells me that the pgml.dtd is not in my "SYSTEM", hmmm, I do a drive search, and indeed, the file is non existent, I looked for it on Google and find no info, and aparently att pgml files out there use a SYSTEM path. So the question is, how do I go about my browser to display PGML pages? Thanks for yout help. Proud aedGUI developer. [edited by - Kwizatz on October 16, 2003 12:01:14 PM]

##### Share on other sites
The standard XML graphics format is SVG (Scalable Vector Graphics), you can find it on the w3c site. VGL and PGML seem to be its predecesors (the date of those documents is somewhere in 1998). SVG is currently not very well supported, in IE you need a (free) plugin from Adobe, in Mozilla you need a special svg build (mozilla.org/projects/svg)

##### Share on other sites
Thanks, I''ll look it up, just one more thing, my xml level would look something like say, this:

<?xml version="1.0" encoding="iso-8859-1"?><level width="32" depth="32" heightmap="heightmap.bmp"><wall x="3" y="4"></wall></level>

Thats not really SVG or PGML, question is can I use the SVG DTD inside my DTD so that the browser knows that a Wall should be drawn as a filled rectangle in position 3,4 in a grid? sounds a lot like thats what XML is all about, and this may be quite a noobish question, but just want to make sure I''ll be able to do, what I want to do , and then again I am a newbie when it comes to XML

Cheers!

##### Share on other sites
You could use XSLT to transform your level into an svg document, something like:

(the code above is not complete, nor is it valid xslt/svg

##### Share on other sites
Thanks, I''ll look up un XSLT and XPath, I was hoping for something a bit more straight forward (drop the level.xml file directly into the browser and voila!), but since I have to get a plugin and then maybe a beta Mozilla release, I dont mind one more step of "compiling" the file.

##### Share on other sites
quote:
Original post by Kwizatz
Thanks, I''ll look up un XSLT and XPath, I was hoping for something a bit more straight forward (drop the level.xml file directly into the browser and voila!), but since I have to get a plugin and then maybe a beta Mozilla release, I dont mind one more step of "compiling" the file.

It doesn''t have to be a "compilation" step. IE, and some versions of Mozilla I believe, will perform the XSL transformation for you on the fly. See http://www.w3schools.com/xsl/default.asp for a good introduction to XSL/T.

--
AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.
[Project site] [Blog] [RSS] [Browse the source] [IRC channel]

##### Share on other sites
Thanks!, I am writting my XSL file now

Cheers!

Proud aedGUI developer.

##### Share on other sites
I think the Nebula device has a simple svg api for its engine on sourceforge.net.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627664
• Total Posts
2978522

• 10
• 10
• 12
• 22
• 13