eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to XML For Web Developers
Ordering Child Elements  

Consider the following DTD snippet....

	<!ELEMENT CONTACT (NAME, EMAIL)>
	<!ELEMENT NAME (#PCDATA)>
	<!ELEMENT EMAIL (#PCDATA)>

In this case, we expect to see XML along the lines of

        <CONTACT>
        <NAME>Jim Sanger</NAME>
        <EMAIL>sanger@sanger.com</EMAIL>
        </CONTACT>

Alternatively, the following code would be valid:

        <CONTACT>
        <EMAIL>sanger@sanger.com</EMAIL>
        <NAME>Jim Sanger</NAME>
        </CONTACT>

We used a comma to order the list because all children must be ordered. We could use a pipe to delimit a list of non-ordered, optional elements, however. [thanks to Jason Suwala for pointing our error on unordered children--ed]. Thus if we redefined our DTD to use

	<!ELEMENT CONTACT (NAME, EMAIL)>
	<!ELEMENT NAME (#PCDATA)>
	<!ELEMENT EMAIL (#PCDATA)>

Then the following XML would be valid

        <CONTACT>
        <NAME>Jim Sanger</NAME>
        <EMAIL>sanger@sanger.com</EMAIL>
        </CONTACT>

but the following XML would be invalid because the EMAIL element would not be allowed to precede the NAME element.

        <CONTACT>
        <EMAIL>sanger@sanger.com</EMAIL>
        <NAME>Jim Sanger</NAME>
        </CONTACT>

Previous Page | Next Page | Table of Contents