Exploring the XML File Format

by Nate on October 6, 2009

Let’s take a deeper look into the .gsz file format.  You’ll remember I’ve mentioned a few times that a .gsz file is just a zip file that contains a bunch of other files.  One of those inner files is what we call the definition file.  The definition file has a .xml extension and generally has the same name as the .gsz.

(If you’ve solved your analyses you’ll see several .xml files.  The definition file is the one in the root directory.)

I’m assuming you are already somewhat familiar with xml in general.  If that’s not a fair assumption, you may want to do some additional reading:

XML Tutorial for the very beginner.
XML definition on wikipedia.

The XML

I’m going to look at the definition file for SLOPE Tutorial.gsz, since it’s included with every installation of GeoStudio. You can also download it here.

There’s a lot of detail in the definition file. Today I’ll just look at the bigger blocks. I may delve into more specific areas in later posts, depending on what feedback I get from you.

Use Notepad or Internet Explorer to open SLOPE Tutorial.xml if you want to follow along.  The first line is:

<?xml version=”1.0″ encoding=”utf-8″ standalone=”yes”?>

That’s the first line of any xml file, and simply defines it as being xml.

<GSIData Version=”7.15″>

The next line is the opening tag that defines this as a GeoStudio file, the “GSIData” block.  (”GSI” stands for “GEO-SLOPE International”.)  This line also identifies the version of GeoStudio that saved the file.

Now comes the good stuff.  A while back I described how a GeoStudio file has “global” objects such as regions and materials which are available to every analysis, and how when you assign a material to a region you’ve just formed a link or “association” between those two objects.  Well this next level in the xml file describes all those “global” objects.

<Analyses Len=”2″>…</Analyses>

The Analyses block describes each analysis.  (From KeyIn - Analyses.)

The Len=”2″ part just indicates how many analyses there are.  It’s not strictly necessary in normal xml, but it helps GeoStudio load the file more quickly because it knows in advance how many analyses are in that block.

<BCs Len=”8″>…</BCs>

The BCs block describes each boundary condition.  (From KeyIn - Boundary Conditions.)  Note that not every boundary condition in the list is necessarily used by your analyses–in fact there are a handful of default boundary conditions created in every file because they’re so common.\

<Contexts Len=”2″>…</Contexts>

This is where the associations are recorded.  There’s a context for each analysis to record which regions and materials are connected, which lines and boundary conditions, and so on.

<Contour>…</Contour>

The Contour block describes how results are visualized.

<Coordinates>…</Coordinates>

Defines the engineering coordinates, page extents and so on.  (From Set - Units & Scale and Set - Page.)

<FileInfo … />

Contains information about the file.  (From KeyIn - Analyses, then click on the root item in the tree.)

<Functions>…</Functions>

The Functions block holds all the functions you’ve defined.  (From the various KeyIn - Functions.)  They’re split into several categories such as <Boundary>, which in turn contains categories such as <StressStrain>.

<GeometryItems>…</GeometryItems>

This is your geometry definition.  It contains coordinates for all the points, lines and regions.

<Materials Len=”2″>…</Materials>

All materials you’ve defined.  (KeyIn - Materials.)

<MeshItems>…</MeshItems>

The mesh that was generated from your regions.  Note that when you open a file, the mesh may be regenerated, so don’t edit this section, your changes may not be used.  If you want to adjust your mesh, you must do it in the GeometryItems section by applying mesh constraints to regions, lines or points.

<SketchItems>…</SketchItems>

Contains sketch lines, circles, text, images and so on.  All the “markup” that doesn’t actually affect results.  (From the Sketch menu.)

<SlopeItems Len=”2″>…</SlopeItems>

Each product (SLOPE/W, SEEP/W, etc.) can have its own section with data that’s specific to that product.  For example, SLOPE/W uses this section to describe slip surfaces, piezometric lines, and so on.  Like the <Contexts> section, there is one <SlopeItem> section per SLOPE/W analysis.

<View>…</View>

Your view preferences, most recent zoom and scroll position, and so on.

</GSIData>

And finally we’re done with the outer GSIData block.

That’s the GeoStudio xml format at a very high level.  I’ll dig deeper into specific sections over the next few weeks.  Let me know if there is anything in particular you’d like covered.

Giang, if you’ve discovered some gems of wisdom as you’ve been working through this yourself, feel free to share!

Updated 3 November 2009:  Exploring the XML File Format - Part 2.

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>