Introduction to writing XML |
XML is a metalanguage written in SGML that is used to allow for the easy interchange of documents on the World Wide Web. Basically, we use it to define scene annotations and actions.
Enough talk, lets write some! Here is a blank.xml file to get you started. Be sure to save this in Annot3D/xmlFiles/ so that it can find the .dtd file. Open it in WordPad or NotePad to edit it.
- For a scene (adding data or annotations)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE scene SYSTEM "scene.dtd">
<?cocoon-process type="xslt"?>
- For a userEvent (mouse events)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE userEvent SYSTEM "userEvent.dtd">
<?cocoon-process type="xslt"?>
- A beginning tag is a word type surrounded by <>'s, such as <green>.A complete tag looks like this:
- Next comes the body (i.e. specification you want to make), such as 1 .
- Now the ending tag is the same word in the beginning tag only this time you use a backslash before the word, such as </green>.
It doesn't matter if there are spaces or returns inside the tag. You could also
do it this way:
<green>
__1
</green>.
It helps to indent the body of a tag when it is on a separate line.
- Just after the beginning tag word, (<scene ) type the property name and an = , like this clientID= .You can have more than one property per tag. Order doesn't matter! Just put them all after the word in the beginning tag. Separate the properties with a space.
- Now type the value you want the property to have in quotes and close off the tag with a > , like this: "one">
- The body and ending tag are the same as before: scenevalue</scene>
You can type it all on one line like this:
<scene><green>1</green></scene>
Or on multiple lines for easy comprehension:
<scene clientID= "one">
__ <green>1</green>
__ <blue>.5</blue>
</scene>
A good thing about XML is that you can have multiple occurances of the same tag. The possibilities are endless so go ahead and put your XML knowledge to use!