in black and white
Main menu
Share a book About us Home
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

the semantic web a gide to the future of XML, Web Services and Knowledge Management - Daconta M,C.

Daconta M,C. the semantic web a gide to the future of XML, Web Services and Knowledge Management - Wiley publishing , 2003. - 304 p.
ISBN 0-471-43257-1
Download (direct link): thesemanticwebguideto2003.pdf
Previous << 1 .. 54 55 56 57 58 59 < 60 > 61 62 63 64 65 66 .. 116 >> Next

<html xmlns=""
<title>Simple example</title>
<xforms:model id="simpleform">
<p>Enter your credit card number below</p>
<xforms:input ref="username">
<xforms:input ref="creditcard">
<xforms:label>Credit Card:</xforms:label>
<xforms:input ref="expires">
Listing 6.9 A simple XHTML 2.0 XForms example.
If the code from Listing 6.9 were submitted, the instance data similar to the following would be produced:
<username>Kenneth Kyle Stockman</username> <creditcard>55555555555555</creditcard>
Of course, this was a simple example. XForms also can take advantage of model item constraints by placing declarative validation information in forms from XML Schemas and XForms-specific constraints. In the preceding example, we could bind the <creditcard> and <expires> values to be valid to match certain schema types. We could also describe our data in our <model>, like the example shown in Listing 6.10, with validation constraints. In that example, you see that the instance is defined in the model. The <xforms:bind> element
Understanding the Rest of the Alphabet Soup
uses the isValid attribute to validate the form. In this case, if someone attempts to submit the information without typing in anything, it will throw an invalid XForm event. Also notice that in the body of the document, individual components of the model are referenced by XPath expressions (in the ref attribute of the input elements).
<?xml version=u1.0" encoding="ISO-8859-1"?>
<!—<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" Æ
<html xmlns=""
<link href="controls.css" rel="stylesheet" type="text/css"/> <xforms:model id="form1">
<xforms:submitInfo id="submit1"
localfile="temp2.xml" method2="postxml" target2=""/> <xforms:instance id="instance1" xmlns="">
isValid="string-length(.)&gt;0" ref="testcase/secret"/> <xforms:bind
isValid="string-length(.)&gt;0" ref="testcase/username"/> </xforms:model>
<b>User Name:</b>
<xforms:input ref="testcase/testcase:input" xmlns:my="test"> <xforms:caption>Enter your name</xforms:caption> </xforms:input>
<xforms:secret ref="testcase/secret">
<xforms:caption>Submit Me</xforms:caption>
Listing 6.10 An XForms example with validation.
Figure 6.6 shows the result rendered in the XSmiles browser, a Java-based XForms-capable browser available at In this example, the username was entered, but the password was not. Because our XForm specified that it would not be valid, an error was thrown.
XForms is one of the most exciting tools that will be included in the XHTML 2.0 specification. It is still a Working Draft, which means that it is continuing to evolve. Because of its power and simplicity, and because instance data is serialized as XML, XForms has the potential to be a critical link between user interfaces and Web services. Commercial support for XForms continues to grow.
Chapter 6
Figure 6.6 Example rendering of an XForm-based program.
Understanding the Rest of the Alphabet Soup
Scalable Vector Graphics (SVG) is a language for describing two-dimensional graphics in XML. A W3C Recommendation since September 2001, there are many tools and applications that take advantage of this exciting technology. With SVG, vector graphics, images, and text can be grouped, styled, and transformed. Features such as alpha masks, filter effects, and nested transformations are in this XML-based language, and animations can be defined and triggered. Many authors use scripting languages that access the SVG's Document Object Model to perform advanced animations and dynamic graphics.
The potential for SVG is quite exciting. Because it is an XML language, data content can be transformed into SVG to create graphically intense programs and animations. Online maps can easily convey the plotting of data, roads, and buildings with SVG.
What does an SVG file look like? Listing 6.11 gives a brief example.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
Previous << 1 .. 54 55 56 57 58 59 < 60 > 61 62 63 64 65 66 .. 116 >> Next