Help:XML

Contents

[edit] What is XML

XML stands for Extensible Markup Language. It is used to store data. If you are familar with computers, it has been a popular buzzword in recent years.

[edit] How This Wiki Uses It

It is possible to embed simple XML fragments in certain entries in this wiki. These XML fragments enhance the wiki by providing a simple method for data retrieval not possible with normal writings. Say you are writing an article about a building. In the article, you might provide some basic info such as the height of the building, when it was built, and what is located inside the building. To a human reading the article, we can easily obtain these facts because of our natural language processing skills. To a computer, extracting these facts from sentences is quite difficult because of all the numerous ways they can be stated. XML comes to the rescue by providing a unified method for storing data in the article. Once the XML is present in the article, computers can easily process the article and extract the necessary information accurately and with great speed.

[edit] What XML Is Allowed

All XML fragments in documents must conform to the Relax NG structures defined at CaseWiki:RelaxNG. When you insert XML into a document, an error message will be returned if the XML does not conform to this schema. A separate error message will be returned if the XML is not formatted properly.

[edit] Embedding XML

To embed XML, insert a valid XML element between the <xmldata> tag. It is possible to embed multiple XML elements in a single page by using separate <xmldata> tags.

XML embedding is only valid for pages in the Metadata namespace. If you attempt to embed XML in any other namespace, it will be transparently stripped out when the article is saved.

For example:

<xmldata>
<building>
  <abbr>WICK</abbr>
  <name>Wickenden Building</name>
</building>
</xmldata>

Depending on the root element, the actual display of the embedded data will vary.

[edit] Customizing the Display of Stored Data

Different types of stored elements can be displayed different ways. This is accomplished through an XSL transform. The full XML source to be used for the transform should be stored in between a <pre> tag in Template:XSLT:element where element is the root element in the embedded XML. For example, the XSLT for the building element is at Template:XSLT:building. If the XSLT is not present or invalid, a message to that effect will be printed.

[edit] Accessing Stored Data

A simple web service to access the stored data is provided at http://wiki.case.edu/misc/xml.php. This script will return an XML document consisting of the root element xmldata. Its children will be every XML node stored in the wiki. In the future, this web service will have the ability to only return a specific subset of data stored in this wiki.

This page has been accessed 2,352 times.
This page was last modified 13:55, July 22, 2005 by Gregory Szorc.
About | Disclaimers