Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
XML's emergence did not initially make our lives easier—at best, they did not change much. We quickly started writing our many data formats using angle brackets, which looked neat, but did not make much of a difference. But, over the years, many new XML-based specifications with disparate and often unique grammars have surfaced. How these grammars, and XML in general, fit into the world of object-oriented technology, at first, did not seem completely clear.
Essentially, we have one more model-mapping problem on our hands. This article looks at XML from the model perspective and tries to answer questions like: What is the model of XML? Does it have one at all? How do we use it while preserving the benefits of object-oriented programming and/or other models (such as relational or entity-relationship). Do the object-oriented model and the XML model fit well together?
To help answer these questions, a few example model rules from Geography Markup Language (GML) are described.
XML has a very simple model. Actually, simplicity was a key requirement in the development of XML. Several of the explicitly stated development goals in the XML specification directly support this quality.
The specification also states that XML shall be generic, i.e., that "XML shall support a wide variety of applications." Simplicity and generality complement each other: by extending a simple model, you can apply it to many different domains.
With XML, the initial learning curve is extremely short to the extent that many deem XML as trivial. However, using XML in real-world applications beyond recording simple data structures (e.g., user preferences or configuration values) and effectively exploiting XML's real power takes some significant time to master. XML's simplicity can often be deceiving.
Proof (although a tautology) of XML's simplicity is that, even with just a few rules taken from the specification, you can quickly produce "correct" XML content. For example, using just a single rule describing how elements are created and nested, you can create an XML file that encodes user preferences for a text editor application. An example of such a file is shown in Listing 1:
Listing 1. Simple XML content
<Preferences>
<AutoSave>5</AutoSave>
<RecentList>
<File>C:\documents\TheArticle.txt</File>
<File>C:\documents\MyNotes.txt</File>
</RecentList>
…
</Preferences>
The XML specification also introduces document schema—the description of the document structure and/or types. This brings in some complexity, but again, not initially. You are free to use any existing schema description language: document type definition (DTD), Resource Description Framework (RDF), XML Schema, or any other. The DTD schema for the example above is shown below:
Listing 2. A simple DTD definition
<!ELEMENT Preferences (AutoSave, RecentList)>
<!ELEMENT AutoSave (#PCDATA)>
<!ELEMENT RecentList (File*)>
<!ELEMENT File (#PCDATA)>
Obviously, a simple document structure is not all there is to XML. As already mentioned, XML is highly extensible. While the basic structure of XML is simple, it does allow the creation of models of arbitrary complexity. And this is exactly what has happened: XML has served as the basis for many different grammars created within or outside the W3C (World Wide Web Consortium). Usually, all of these grammars together are called "XML technology."
| Subject | Replies |
Last post
|
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq