![]() |
|
| • All Online Courses • New Courses • QuickTips • Word Definitions • Submit a Tutorial • Links • |
|
Learn XML programming in this free XML training course What is the ANY content model?As mentioned in a note earlier, the ANY content model can cause problems if not handled correctly. Basically, it sets the rule for your element or attribute to “anything goes”… meaning that the element will accept chunks of text, pictures, or even references to other programs without caring what they are. This is fine for testing or initial programming, but it can lead to problems down the line if the element or attribute that’s been set to “any” is working in conjunction with other elements, attributes, or programs that require specific types of data. If not used carefully, it might try to send picture data to an element that’s working with text only… and then everything comes crashing down. If you want to use the ANY model, though, the format is very simple. Going back to the previous example in which cats_info was declared as a text element, substituting ANY for the text declaration will give you the following: <!doctype cats_info [ <!element cats_info (ANY)> ]> When your DTD encounters this, it will know that cats_info is an element, and it will accept any type of data. Just remember to use caution when putting elements and attributes at this setting. What are repeated elements, and how are they handled?Sometimes, you’ll have a certain element that you want to use several times… each instance might have slightly different data in it, but it all falls into more or less the same type of data and covers the same topic. Instead of having to list a variety of different elements to enter all of your data, you might want to instead use a repeated element. A repeated element is just what it sounds like… an element that’s repeated and used several times within the same document. If you were working on an XML document and wanted to list the names of your cats and the cats of your friends, you wouldn’t necessarily have to list each cat as a separate and distinct element… as an example, consider the following: <cats_info> <cat>Tooter</cat> <cat>Shade</cat> <cat>Loki</cat> <cat>Sally</cat> </cats_info> Even though each instance contains different data, the repeating element cat is used for each one. Just make sure that you don’t repeat the same data in two places… it can cause an error because repeating elements need to have unique data so that the XML document can tell them apart.
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:
About Us : Contact Us : Advertise : Privacy Information