XML
  Home arrow XML arrow Page 3 - XML Basics
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
XML

XML Basics
By: Mamun Zaman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 27
    2007-09-05

    Table of Contents:
  • XML Basics
  • XML Tags and Conventions
  • More on Elements
  • XML Schema

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    XML Basics - More on Elements


    (Page 3 of 4 )

    Some elements may appear several times and some may not appear. In DTD, this multiplicity can also be defined.

    + defines one or more times
    * defines zero or more times
    ? defines an optional element, that is one or not at all

    Some examples of multiplicity include:

    <!ELEMENT Customer (Name, CardInfo+) > : A Customer can have a mandatory Name sub-element and one or more CardInfo sub-elements.

    <!ELEMENT Name (FirstName, MiddleName?, LastName) > : FirstName and LastName will appear one time and MiddleName may appear or not.

    <!ELEMENT Purchase (ItemNo, Title, Price)* > : A Purchase element may have several sub-elements which include ItemNo, Title and Price or none at all.

    Here is the complete DTD declaration for our book example.

    <!DOCTYPE bookstore [
          <!ELEMENT bookstore (book)*>

          <!ELEMENT book (title, author, year, price)>
          <!ELEMENT title (#PCDATA)>
          <!ATTLIST title id CDATA "0">
          <!ELEMENT author (#PCDATA)>
          <!ELEMENT year (#PCDATA)>
          <!ELEMENT price (#PCDATA)>
    ]>

    DTD can be internal or external. Internal DTD means the definition, like the one above, would be specified after the XML processing instruction -- <?xml version="1.0" ?>. External DTD is a reference to an external definition like the one below.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    More XML Articles
    More By Mamun Zaman


       · its very good to understand how and why the xml is used extensivly hope it is more...
       · Whenever i think about XML i think it's too hard by reading these article i get some...
     

    XML ARTICLES

    - Using Regions with XSL Formatting Objects
    - Using XSL Formatting Objects
    - More Schematron Features
    - Schematron Patterns and Validation
    - Using Schematron
    - Datatypes and More in RELAX NG
    - Providing Options in RELAX NG
    - An Introduction to RELAX NG
    - Path, Predicates, and XQuery
    - Using Predicates with XQuery
    - Navigating Input Documents Using Paths
    - XML Basics
    - Introduction to XPath
    - Simple Web Syndication with RSS 2.0
    - Java UI Design with an IDE







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek