HomefieldOfView | SPi-V dev

Legend

  • required
  • not yet implemented

Navigation

user

A simple SPi-V XML document

When an image file is specified as the file to open (as opposed to an XML file), the SPi-V engine creates an XML file around this file internally. This article will show and explain this simple XML document.

The files for this article can be downloaded in the downloads section.

In the XML document below, the filename of the file that was supplied ("panorama.jpg") is highlighted. Once you are done reading this message you may want to look up more information about each node. This information can be found in the node reference, or by clicking the node names in the XML document below.

<?xml version="1.0"?>
<tour>
  <scene id="simple_scene">
    <meta>
      <title>Simple mode scene</title>
      <description>This panorama was automatically generated from a single input image 
        without parameters. You can customise viewing parameters using an XML file. 
    See www.fieldofview.com/spv for more info.</description>
    </meta>
    <panoelement id="simple_pano" image="simple_image" />
    <image id="simple_image">
      <layer class="base" type="bitmap" src="panorama.jpg" />
    </image>
  </scene>
</tour>

Node by node

Let's step through this XML file node by node.

<?xml version="1.0"?>
The first line identifies this document as an XML document. XML documents look a lot like HTML, but there are a number of subtle but important differences:
  • All XML elements must have a closing tag, and must be properly nested
  • When writing any XML document, special care should be taken that all tags must either have a corresponding closing tag (eg <tour> ... </tour>) or specifically close themself (eg <panoelement ... />). Note that - to make matters confusing - the XML declaration itself is not a node and does not have to be closed. It is good practice to use indentation when writing XML documents to ensure proper nesting.
  • XML tags are case sensitive
    To make this easier on you, all tag names in the SPi-V node specification are all lowercase
You can read more about XML here.

<tour>
The tour node is the root node of a SPi-V XML file. It has no properties of its own, but it can include several different panoramic scenes that can be linked together.

  <scene id="simple_scene">
The scene node partitions a tour into seperate panoramic scenes. The required id attribute can be any alphanumeric value, as long as it is unique for the tour. The id is used for ezample when jumping from a scene to another scene.

    <meta>
Inside the meta node, you will find information about the panoramic scene that is not necessarilly visible. This includes a title and description etc, as well as some configuration data such as how the viewer behaves when viewing the scene.

      <title>Simple mode scene</title>
The title is shown in the information window within the viewer, and within the titlebar of the standalone viewer. The title can include special characters, as long as they are properly escaped.

      <description>This panorama was automatically generated from a single input image 
        without parameters. You can customise viewing parameters using an XML file. 
    See www.fieldofview.com/spv for more info.</description>
This description of the panoramic scene is entirely optional. It will be displayed in the information window of the viewer. Special characters must be properly escaped.

    </meta>
Closes the meta tag

    <panoelement id="simple_pano" image="simple_image" />
The panoelement node is the meat of a scene. panoelement nodes reference an image node and tell the viewer how to place this image in the panoramic scene. Normally, these nodes are a lot more descriptive and has a lot of attributes. In this case, most of these attributes are left for the viewer to discover/guess. The id is once again required.

    <image id="simple_image">
In SPi-V, an image consists of layers. These layers can have different functions within the viewer, such as different appearances when the mouse hovers over the image etc.

Note how the panoelement references the image node: (pseudo code)

    <panoelement id="..." image="simple_image" />
    <image id="simple_image">
      ...
The panoelement node is a single (self-closing) node ans references the image node through its id. SPi-V also allows an alternative way of referencing nodes:
    <panoelement id="...">
      <image id=".....">
        ...
    </panoelement>
If the image attribute is omitted, the viewer will try to use the first image node that is a child of the panoelement node. It is often up to personal preference which notation to use.

      <layer class="base" type="bitmap" src="panorama.jpg" />
In this case, the image consists of a single bitmap image.

    </image>
Closes the image tag

  </scene>
Closes the scene tag

</tour>
Closes the tour tag