Learnthat.com Free Certification and Computer Online Courses
ThatNetwork.com Internet Media Network Exampractice.com free certification practice exams, mcse, comptia Definethat.com - Free technical definitions, define Free Romance Tips, Romantic Tips, Date Ideas Free POD publisher comparison print on demand
Learnthat.com Free A+ Certification, Computer Classes, Certification Courses, Business, Lifestyle, ApplicationsFree business tutorials and definitionsFree certification tutorials and definitionsFree computer and technical tutorials and technical definitionsFree Finance Tutorials and DefinitionsFree House Repair TutorialsFree Lifestyle and Fun Tutorials
  All Online CoursesNew Courses QuickTipsWord DefinitionsSubmit a TutorialLinks
÷ Resources
Home
free tech tutorials
Free Tutorials
free tech tutorials
Certifications
free tech tutorials
Definitions
free tech tutorials
Resources/Links
free tech tutorials
Forums
free tech tutorials
Distance Education
free tech tutorials
Highest Rated Tutorials
÷ Popular Tutorials
÷ New Tutorials

Learn XML programming in this free XML training course

 

How do you declare empty elements?

Sometimes, you need to create an element that doesn’t have anything in it at first, so that data can be placed into it by either an end user or by the XML program itself.  The problem with this is that you have to create the element, but not define any data within it… something that’s not easily accomplished in a lot of programming languages.  Luckily, XML is prepared to handle this situation with the appropriately-named EMPTY validation rule for elements.

You may remember seeing EMPTY on the list of validation rules earlier… it might even have struck you as a bit odd to see something that created elements with nothing in them.  Elements created this way often have attributes associated with them that have meaning and values, thus using the empty element as somewhat of a placeholder for the other attributes.

To create an empty element, use the following format:

            <!element cats_info EMPTY>

Wherein cats_info would be the element that you were creating to be empty.

What is some of the jargon used with entities?

Different jargon is used with various entities to effect the processing of XML codes in different ways.  Attribute lists can be created for entities dealing with multiple attributes, and data referenced by entities can be either required or implied.

To create an attribute list, begin by declaring the name of the list, like so:

            <!attlist cat_characteristics

The attlist stands for attribute list, and cat_characteristics is the name of the list.  From there, it’s time to begin listing attributes.

            <!attlist cat_characteristics

                        hair_length

                        hair_color

                        name

            >

Note that the closing > was placed on a line of its own. This makes things a lot easier if you have to add or modify any of the listings… just make sure that you don’t forget it.

As was mentioned a moment ago, data can also be either required or implied.  What this means is that the data may or may not be present when the XML file first begins to run, and through use of the #required and #implied tags you can create rules to let the program know whether it needs the information at onset or not.  Required means that the data is present when it begins to run and thus is available for use, and implied means that it might not be present so it shouldn’t try to access it until it’s been defined elsewhere.

Using these to define rules for attributes would look like this:

            <!attlist cat_characteristics

                        hair_length #implied

                        hair_color #required

                        name #required

            >

This way, the attributes hair_color and name are defined somewhere, and therefore are required… hair_length, on the other hand, might not be, so it shouldn’t be accessed yet.

 

by John Casteele

Find more free Internet tutorials from Learnthat.com.

More Information:

Help us by rating this tutorial: [---] [--] [+] [++] [+++]
[---] lowest; [+++] highest

 

 

 


Learn: Free Tutorials - Links to Free Tutorials
Understand: Free Technical Definitions - ExplainThat Whitepapers
Use: Certification Section - Discussion Forum

Visit Our Network Sites:

DefineThat.com Technical Defintions Romancetips.com
Free Gift Ideas - GiveThat Planthat.com Free Unique Business Ideas
PublishOnDemand.net - Learn about Print on Demand (POD) - Self Publishing Seekthat.com - Technical Search Engine
ThatNetwork.com  

About Us : Contact Us : Advertise : Privacy Information

© 1998-2004 Learnthat.com