|By Steve Hoenisch||
|June 3, 2001 12:00 AM EDT||
This month's tutorial, the second in a series, picks up where last month's left off - on the path toward publishing your résumé on the Internet as an XML document. Last month (XML-J, Vol. 2, issue 5) I presented an overview of XML, described its basic building blocks, and demonstrated how to create a simple XML document.
This month, after reviewing XML's fundamental components, I'll guide you through the process of marking up a résumé with XML. In doing so the column touches on the fundamentals of structuring and marking up data as well as some of the concepts - such as hierarchical trees, nodes, and parent-child relationships - that underlie XML documents.
My objective is to help you learn how to structure a document using XML. Toward that end I'll compare three approaches to tagging based on presentation, structure, and content, thus laying the groundwork for developing a tagging strategy for résumés. Next we'll turn to a quick discussion of hierarchical trees that will supply the terminology needed to address the abstract structure of XML documents. Then we'll review last month's hands-on work and expand on it while marking up a résumé in XML. Throughout the column I'll introduce you to several new language constructs, building on last month's tutorial.
XML's Building Blocks
First we'll review the XML fundamentals covered last month peppered with a few new constructs.
Remember A simple XML document must contain at least one XML processing instruction and one or more elements, all encased in angle brackets. Processing instructions start with <? and end with ?>. XML documents begin with a processing instruction that contains an XML declaration: <?xml version="1.0" standalone="yes"?>. The stand-alone attribute, which is optional and takes yes or no as its value, specifies whether an external DTD is required. If the value is yes, an external DTD is not required.
The XML processing instruction on the first line of your document may also define the character set used, and it's generally a good idea to include it. By default XML documents use the UTF-8 encoding of Unicode. But you may use the encoding keyword to insert a declaration that specifies that set or another set, as in the following example:
<?xml version="1.0" encoding="UTF-16"
All the gritty details about the available character sets, including which to use when, can be found in XML in a Nutshell, by Elliotte Rusty Harold and W. Scott Means (O'Reilly). Additional technical details about character encoding can be found at www.w3.org/TR/REC-xml#charencoding.
XML documents also typically include a document type declaration that begins with <!DOCTYPE and performs two main functions:
- References a document type definition, or DTD
- Identifies the document's root element
In the following declaration the root element is the word after <!DOCTYPE:
<!DOCTYPE resume>The document type declaration, however, is not required for the document to be well formed. A well-formed document is one that adheres to the rules of XML syntax. A valid XML document, in contrast, is one that conforms to the constraints of a DTD.
Even though the root element has been specified in the declaration, it must still appear as the document's first element:
<resume>Besides a root element, XML documents typically contain a hierarchy of nested elements. However, there are a few restrictions on the characters that may be used in element names, especially as their first symbol. In particular, element names must begin with an underscore or a letter in either upper- or lowercase, but never a number. The tag <2001Resume> isn't permitted. After starting with a letter or underscore, a tag may contain numbers as well as other letters, hyphens, underscores, and periods.
The use of colons is illegal unless you're specifying a namespace, which will be addressed in a later column. It's also illegal to begin an element name with the letter combination of xml in any variation of upper- and lowercase. And don't forget that the sequence of symbols used in your opening and closing tags must be exactly the same.
For more information about legal and illegal tags in element and attribute names, see Robert Eckstein's XML Pocket Reference (O'Reilly). The technical details about valid XML characters are available at www.w3.org/TR/REC-xml#charsets.
All elements, including the root, may optionally take one or more attribute-value pairs. XML documents may also contain comments; they begin with .
Remember, too, that an XML document must adhere to certain markup and syntax rules to be considered well formed. First, XML is case sensitive, and the name of an opening tag must match the name of its closing tag. Second, an empty element - one that contains no other elements or text - must have a closing tag that may be combined with the starting tag. Thus, an empty element can be marked up either as <phone></phone> or as <phone/>. Third, every nonempty element's opening tag must have a corresponding closing tag. If you open an nonempty element with <resume>, it must have a corresponding closing tag of </resume> that's properly nested, which brings us to our fourth rule - XML documents may not contain any overlapping tags. Whereas <h2><i>Headline</h2></i> might work in HTML, it won't in XML. Finally, all attribute values must be enclosed in either single or double quotation marks.
When we delve into the tutorial below and the review of last month's work, you'll see how the components and rules above are used to create XML documents.
If you need more information about what I just reviewed, you may want to spend a few minutes reading up on the basics of XML. If you don't have a copy of last month's XML-Journal handy, I suggest you read the following references: the first half of Chapter 1 in Brett McLaughlin's book, Java and XML (O'Reilly); and Chapter 1 plus pages 11-16 of Chapter 2 in XML in a Nutshell. More about constructing well-formed XML can be found in the XML Pocket Reference. Taken together these readings should bring you in-line.
Before marking up an isolated document with tags, there are several key markup-related decisions to make: (1) choosing a convention for tag names, (2) deciding what information to capture in attributes as opposed to child elements, and (3) choosing an approach to markup.
Besides the obvious - consistency - choosing a convention for tag names should be guided by the following criteria:
- Ease of reading: One of the W3C's stated goals for XML documents is that they're legible to humans (as opposed to machines) and reasonably clear. Your tagging scheme should reinforce XML's self-documenting capacity and not undermine its legibility. (For more on the goals of XML see www.w3.org/TR/REC-xml#sec-origin-goals.)
- Simplicity and ease of usability and re-creation: In general, the simpler your naming convention, the easier it'll be to apply. An easy-to-remember naming format will make writing stylesheets and DTDs easier, too.
- Compatibility with XHTML
- The potential for reuse with or incorporation into preexisting document type definitions (DTDs), XSL stylesheets, and tag lists
- Ease of use of tag content, especially attribute values, in target output
1. <ELEMENT>Compatibility with XHTML rules out option 1. In XHTML all HTML tags must be lowercase. Besides, anything written in all capital letters, even tag names, is hard to read. Option 2 is a bit easier to read; however, if you mix your tags with XHTML tags, which is useful to do at lower levels in the hierarchy of traditional documents such as software manuals, especially those destined for publication on the Web, you'll also find your tags becoming inconsistent: the tags you define begin with an uppercase letter while the XHTML tags begin with a lowercase letter.
Option 3 then seems to be the choice that would ensure the greatest consistency, especially if you're considering using XHTML in your XML markup. Using lowercase tag names also increases the potential for reusing preexisting tag lists, XSL stylesheets, and DTDs, as most XML programmers seem to prefer lowercase tags. For instance, UltraEdit, a text editor, comes with an XML tag list containing tags in lowercase.
Complex element names and the addition of attributes force us to make more decisions. Consider these tags:
4. <elementname property="hard to read">
5. <element_name property="Easy to Read">
6. <elementName property="Easy to Read">Option 4 is difficult to read, ruling it out. Options 5 and 6 are equal in readability and the potential for reuse with existing DTDs and stylesheets. Some XML programmers use option 5 while others use 6. Others use a hyphen instead of the underscore in option 5. For its tag list UltraEdit uses option 6. Still others use option 4, as can be seen by viewing the XML markup behind the XML specification itself. It's an interesting case study in XML markup. Take a moment to study it (in Internet Explorer version 5.0 or greater, go to www.w3.org/TR/2000/REC-xml-20001006.xml).
While elements are the principal means for structuring data, attributes are typically used to capture properties of elements, and their values further modify or set a value for the property, as this tag demonstrates: <desk color="blue">.
If you choose to set your element names in lowercase, it's best, I believe, to set attribute names in lowercase, too, fostering consistency. The case of attribute values, however, is a bit trickier. The deciding factor is how they'll be used. In narrative-oriented documents I often use attribute values to contain metacontent about elements names: <section type="Introduction">. Besides making the value easier to read amid other coding, capitalizing it fosters its reuse as a headline when the document is outputted through an XSL stylesheet.
Before coding your document you'll also need to decide what information to capture in attributes as opposed to child elements. The approach I use for traditional documents is to capture metainformation but not content in attributes. XML in a Nutshell addresses the question of using attributes versus child elements in Chapter 2, "XML Fundamentals." This chapter reinforces and expands on the concepts discussed in this column.
Choosing an approach to markup is another decision you should make before you begin. The three principal markup strategies are:
- Presentation-based tagging
- Structure- or publication-oriented tagging
- Content- or information-based tagging
Presentation: <ital>damn</ital>The markup strategy behind HTML is based almost entirely on presentation. Tags such as <h1>, <i>, and <b> indicate how content should be presented through a browser. The motivation behind using XML, however, is that it allows you to separate content from presentation and to structure data based on meaning, resulting in data and documents that are easier to reuse, manipulate, and search. Using a presentation-oriented approach exclusively defies the purpose of XML. It's better to use either a structure- or content-based approach.
Structure-based tagging is a generic, flexible approach with a wide scope, most useful when exchanging documents within a discipline or across industries. Employing a loosely structured DTD, it emphasizes elements such as <section>, <subsection>, and <paragraph>. Additional information about content is often delegated to attributes: <section id="Introduction">.
Content-based tagging is a less flexible, custom approach with a narrow scope that's most useful when modeling content around clearly defined user needs, a unique class of documents, or both. Using a tightly structured DTD, it emphasizes the use of elements such as <introduction> and <explanation>.
In reality, however, most documents intended for publication on the Internet or intranet combine all three approaches. The higher levels of the hierarchy use content-based tags, the middle levels use structure-oriented ones, and the lower levels, especially at the clausal level, may, for expedience, use some presentational tags from XHTML.
Since the focus of this column is on creating XML documents for publication on the Internet, we'll use a combination of all three approaches and learn a bit about XHTML as we do so. But as you mark up documents in XML, you'll have to evaluate the structure of your documents and how they'll be used before you decide on your own approach. Just be sure you do some planning and design before beginning the markup process. David Megginson's book, Structuring XML Documents (Prentice Hall), offers a plethora of information and good advice about choosing an approach to tagging that works best for your document or project.
Last month I asked you to start getting your hands dirty with XML by using a text editor such as Notepad or UltraEdit to mark up your résumé, or part of it. I suggested that you use not only elements but also attributes and that you try to create tags describing the structure or content of your résumé. I also suggested that you think about what aspects of your résumé should be captured in attributes as opposed to elements. Marking up part of your résumé in XML and debugging it in Microsoft Internet Explorer 5.0 or greater should have resulted in the document being displayed like the hypothetical résumé fragment in Figure 1.
Notice how Internet Explorer's default view for an XML document reveals its hierarchical structure. The minus and plus signs allow the document to be displayed as a collapsible outline, indeed, as a collapsible tree. In XML, various concepts, most of which spring from the way we speak about trees or families, are used to express relationships within an XML document's hierarchical structure. At the base of its hierarchy each tree has a root element, which can be seen in Internet Explorer by clicking on the first minus sign of an XML document. From the root node stems a hierarchy of other branches and leaves. Leaves are terminal elements since they don't contain child elements.
Each element in a tree structure is called a node. Relationships among nodes are expressed using metaphors borrowed from families. The root node, for instance, is the parent of all the other nodes, called children; together they enter into a parent-child relationship. Although a parent element can have multiple children, each child node has exactly one parent node. XML and its accompanying specifications such as XPointer use such constructs as parent, child, sibling, ancestor, and descendant in keywords, expressions, and functions. For more information on parent-child relationships and related constructs, see XML in a Nutshell and XML Pocket Reference.
Bringing to bear the XML constructs and strategies discussed above, let's step through the coding of part of an actual résumé. It is, of course, a bit more difficult than the coding behind the hypothetical one shown in Figure 1, which, perhaps somewhat naively, uses content-based tagging exclusively.
The way we intend to use the résumé determines, to a certain extent, how we should mark it up. If you're building a Web site that collects and presents résumés from job seekers, you'd probably want to employ a different markup strategy from one used to code a résumé for isolated publication on the Web. My primary objective here is to structure the content of the résumé in such a way that I can use it as the source for different output formats, not only HTML but also plain ASCII text, Portable Document Format (PDF), and Wireless Markup Language (WML). I'd also like to keep the résumé's structure somewhat flexible in case I decide to add additional material, such as a listing of computer skills or references. To mark up the résumé I'll blend all three markup approaches using both content- and structure-oriented tagging complemented by a smattering of presentation-based tagging at the lowest levels. Throughout, I'm careful to avoid duplicating information.
I begin with the usual XML processing instructions and include a character encoding declaration. The standalone value of "yes" indicates that an external DTD is not required.
<?xml version="1.0" encoding="UTF-8"Next comes the document type declaration, which specifies that the document's root element is résumé.
<!DOCTYPE resume>The markup starts with the root element and branches into two high-level structure-oriented elements: header and section. I decide to use a repeatable structure-oriented section element instead of a set of nonrepeatable content-based tags such as experience and education since it enables me to add additional sections later.
To capture the content of each section, I use the value of the ID attribute.
<resume>Instead of using a content-based tag like qualification for each item in the list of qualifications, I decide to simply borrow HTML's unordered list elements:
<street>10 First Avenue</street>
<portfolio>Online portfolio available
at <a href="http://www.JaneDoe portfolio.com"> www.JaneDoe
<objective>To obtain a position as a <emph>content
<head>Summary of Qualifications</head>
<li>In-depth knowledge of multimedia design.</li>
<employer>XYZ Multimedia Inc.</employer>
<duration>March 1998 through February 2001</duration>
<li>Created multimedia content for the company's Web site.</li>
<li>Used Photoshop to refine graphics created by other authors.</li>
Because the year of graduation is not always displayed in a résumé but may still be useful information to have, it is encoded using an attribute:
<degree year="1997">MA</degree>Hands-on Work
<school>University of Washington</school>
This is, of course, just one possible way to mark up a résumé, not necessarily the best way. Deciding on how to build a data structure for a large set of résumés that will be made available on a Web site is a complicated task requiring consideration of a number of factors, including the wholesale avoidance of duplicate information, the flexibility to accommodate résumés written in different styles and with different content, and the capability to conduct specialized searches. Mark Wilson and Tracey Wilson, in Chapters 1 and 2 of their book, XML Programming with VB and ASP (Manning), provide additional examples about how to mark up a résumé or a collection of them in XML, but more important, they also explain the motivations for wanting to do so. W. Scott Means' article "Converting Unstructured Documents to XML," at http://xml.oreilly.com/news/xmlnut3_ 0301.html, demonstrates how to isolate elements to reveal a document's underlying structure. I recommend it.
To prepare for next month's column, analyze the way in which I structured the data in this résumé and identify what, in your opinion, I should have done differently. E-mail me with your point of view and the justification for it. But don't stop there. First, revisit the way you structured your résumé after reading last month's column; finish marking it up and debugging it in Internet Explorer 5.0 or greater if you haven't done so already. Second, conceptualize the rules that should constrain a résumé's data. To spur you down this path, I suggest you read pages 89-108 of Chapter 4, "Constraining XML," in Java and XML, written by Brett McLaughlin (O'Reilly).
Next month we'll dive headfirst into constraining XML data with document type definitions, or DTDs.
In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), will provide an overview of various initiatives to certifiy the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldw...
Mar. 24, 2017 08:15 PM EDT Reads: 244
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Mar. 24, 2017 08:00 PM EDT Reads: 1,502
Your homes and cars can be automated and self-serviced. Why can't your storage? From simply asking questions to analyze and troubleshoot your infrastructure, to provisioning storage with snapshots, recovery and replication, your wildest sci-fi dream has come true. In his session at @DevOpsSummit at 20th Cloud Expo, Dan Florea, Director of Product Management at Tintri, will provide a ChatOps demo where you can talk to your storage and manage it from anywhere, through Slack and similar services ...
Mar. 24, 2017 06:30 PM EDT Reads: 4,105
My team embarked on building a data lake for our sales and marketing data to better understand customer journeys. This required building a hybrid data pipeline to connect our cloud CRM with the new Hadoop Data Lake. One challenge is that IT was not in a position to provide support until we proved value and marketing did not have the experience, so we embarked on the journey ourselves within the product marketing team for our line of business within Progress. In his session at @BigDataExpo, Sum...
Mar. 24, 2017 06:30 PM EDT Reads: 2,604
What sort of WebRTC based applications can we expect to see over the next year and beyond? One way to predict development trends is to see what sorts of applications startups are building. In his session at @ThingsExpo, Arin Sime, founder of WebRTC.ventures, will discuss the current and likely future trends in WebRTC application development based on real requests for custom applications from real customers, as well as other public sources of information,
Mar. 24, 2017 05:30 PM EDT Reads: 373
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Mar. 24, 2017 05:15 PM EDT Reads: 1,290
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Mar. 24, 2017 04:45 PM EDT Reads: 1,765
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Mar. 24, 2017 01:15 PM EDT Reads: 3,844
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
Mar. 24, 2017 01:15 PM EDT Reads: 562
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
Mar. 24, 2017 12:45 PM EDT Reads: 1,859
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Mar. 24, 2017 12:15 PM EDT Reads: 958
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
Mar. 24, 2017 12:15 PM EDT Reads: 1,396
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Mar. 24, 2017 12:00 PM EDT Reads: 1,886
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
Mar. 24, 2017 12:00 PM EDT Reads: 1,640
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Mar. 24, 2017 10:45 AM EDT Reads: 1,421
SYS-CON Events announced today that Infranics will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
Mar. 24, 2017 09:45 AM EDT Reads: 2,736
Now that the world has connected “things,” we need to build these devices as truly intelligent in order to create instantaneous and precise results. This means you have to do as much of the processing at the point of entry as you can: at the edge. The killer use cases for IoT are becoming manifest through AI engines on edge devices. An autonomous car has this dual edge/cloud analytics model, producing precise, real-time results. In his session at @ThingsExpo, John Crupi, Vice President and Eng...
Mar. 24, 2017 08:45 AM EDT Reads: 3,679
In the enterprise today, connected IoT devices are everywhere – both inside and outside corporate environments. The need to identify, manage, control and secure a quickly growing web of connections and outside devices is making the already challenging task of security even more important, and onerous. In his session at @ThingsExpo, Rich Boyer, CISO and Chief Architect for Security at NTT i3, will discuss new ways of thinking and the approaches needed to address the emerging challenges of securit...
Mar. 24, 2017 08:30 AM EDT Reads: 4,263
The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, will posit that disruption is inevitable for c...
Mar. 24, 2017 08:30 AM EDT Reads: 1,907
There are 66 million network cameras capturing terabytes of data. How did factories in Japan improve physical security at the facilities and improve employee productivity? Edge Computing reduces possible kilobytes of data collected per second to only a few kilobytes of data transmitted to the public cloud every day. Data is aggregated and analyzed close to sensors so only intelligent results need to be transmitted to the cloud. Non-essential data is recycled to optimize storage.
Mar. 24, 2017 08:15 AM EDT Reads: 2,903