XML
Contents |
XML
XML stands for extensible mark up language. The language itself is merely a set of rules or standards that are used in creating a valid xml document. XML is a general standard that can be applied to virtually any need or application.
XML is most useful for describing relationships between objects. A given xml node can have any number of nodes within it. We consider those nodes children of their parent node. Nodes that have the same parent are called siblings. An xml node is notated with the syntax as follows: <node>...</node>. The contents for a node are included in between the node's opening and close tags. The following are all examples of valid xml:
(If any who edit this can figure out how to get the wiki board to show these xml examples better, I would be much obliged.)
example1:<node>Apples are Red</node>example2:
<parent>
<child1/>
<child2/>
</parent>
Notice that a node with nothing contained inside it can be closed with /> in the opening node tag. Also notice that in XML there are no rules for what a node is named. It is however required that the spelling (case-sensitive) of the opening and closing tags match.
It is invalid xml to have improperly or imballanced nodes. The following is an example of invalid nesting:
<a> <b></a></b>
Notice that we are trying to end "a" tag before its child node "b" tag has terminated.
The examples above demonstrate xml structure, but they don't store much information. Generally speaking, the nodes and their relationship in the document are used for structure and node attributes are used for storing information. There are many times when this is not the case, but it is a loose rule of thumb. A node can have attributes
Attributes
Any node can have attributes assigned to it. Attributes describe the node. For example we could have a node
<tree type="apple" trunkCircumference="20" height="120">
<branch circumference="6" length="4">
<branch circumference="2" length="1"/>
</branch>
</tree>
Why XML?
XML is so useful because it is a standard that has been accepted across the industry. This means that virtually all programing environments have libraries included to make parsing xml quite painless for developers. XML is a generic enough standard that it can lend itself to describing almost anything as well.
When not to use XML
There are many cases where a fully functional data base will better serve the needs. Databases are more efficient for extremelly large quantities of data, and are able to more effectively handle extremely complicated relationships. XML is a very useful and powerful tool, but it is not always the right tool for the job at hand.
Notable Uses of XML
HTML: Not all html is valid xml, but many developers are now using XML compliant HTML. This is prefered by many because it keeps the HTML more structured and usually provides more predictability in how the page is going to behave in multiple browsers.
XAML: XAML is a technology that is still in its infancy and is created by Microsoft. XAML is XML used within the future development environments Microsoft is developing. XAML is a mark up system that generates vector graphics for interfaces and interaction. It can describe animations, shapes, gradients, interface tools and much more. The newest version of Microsoft Windows will be entirely XAML based for its interface. This means that future software development for windows will be able to leverage vector based interfaces which will scale flawlessly for any screen resolution among other things. Another exciting feature with XAML is with the web. Internet Explorer 7 will support XAML, and Microsoft will be releasing plug ins for all other major browsers. XAML based web pages will be nearly indistinguishable in their look and feel from standard windows applications.
- This page was last modified 18:00, 15 September 2006.
- This page has been accessed 1,144 times.
- Content is available under GNU Free Documentation License.
- About CGWiki
- Disclaimers

