XML Elements

Elements

Elements are used to categorize the data in XML document, thus making the data “self-explanatory”. A tag is just another name for an element.  An opening tag is the element name enclosed in brackets and a closing tag is the same as an opening tag with a slash before the element name.  The information of the elements is enclosed within open and closing tags. An example of this is shown below:

 

Example: <animal>cat</animal>

 

Attributes are used provide more specific information about the element and appear within the opening tag.  Attributes provide a way to focus elements in a way to fit the needs of the XML document creator. If there are several values possible for an attribute, the value must be specified.  So if a tag has an attribute for color the values may be green, yellow, blue, red, etc.  An example of an element attribute is the following:

Example: <animal breed=Siamese>cat</animal>

There are some rules to consider when determining element names.  They are the following:

  • cannot contain spaces
  • can contain letters, numbers, and any other characters
  • cannot begin with a number or a punctuation character
  • cannot begin with “xml”

With these rules in mind, there are also some best practices associated with element naming.  They include the following:

 

  • Since some XML documents have a corresponding database it is a good idea to use the naming rules of that database.
  • Non-English letters are acceptable in XML, but be sure that the software being used supports them.
  • Make names as descriptive as possible.
  • Don’t hesitate to use an underscore as a separator: <first_letter>, <last_letter>.
  • Try to keep names short and simple.  For example, Use <baby_name> rather than <the_name_of_the_baby>.
  • Avoid the “.” character. For example, in “first.letter,” some software may interpret this to mean that “letter” is a property of the object “first.”
  • Avoid the “-” character. For example, in “first-letter,” some software may interpret this to mean that you want to subtract “letter” from “first”.
  • Avoid the “:” character because colons are usually reserved for namespaces.
This entry was posted in XML Tutorial. Bookmark the permalink.

49 Responses to XML Elements

  1. Nisha Grady says:

    I was curious if you ever considered changing the layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two pictures. Maybe you could space it out better?

  2. I?ve recently started a blog, the information you offer on this website has helped me greatly. Thank you for all of your time & work.

  3. I see your point, and I totally appreciate your article. For what its worth I will tell all my friends about it, quite resourceful. Later.

  4. I like this – Gulvafslibning | Kurt Gulvmand , enjoyed this one regards for posting keep update – Gulvafslibning | Kurt Gulvmand.

  5. Merlin Racz says:

    Howdy, just turned into cautious of your website through Google and yahoo, and discovered that must be seriously interesting. I am gonna be careful for brussels. I could be thankful if you decide to continue this in the long run. Lots of people could be benefited from your blogging. Many thanks!

  6. bandar judi says:

    104225 195015Awesome material you fellas got these. I in fact like the theme for the website along with how you organized a person who. Its a marvelous job For certain i will come back and take a look at you out sometime. 793949

  7. I have been previously looking at for a little bit for any quality content within this sort of place . Discovering in Yahoo I finally found this web site. Reading this info So i am happy to express that I have an incredibly excellent uncanny feeling I found out just what I needed. I most without doubt will ensure to never ignore this site and offers it a glance constantly.

  8. 121679 575004Hey, you used to write great, but the last few posts have been kinda boringK I miss your super writings. Past several posts are just a bit bit out of track! come on! 34973

  9. Santiago says:

    This is the right weblog for anyone who wants to find out about this topic. You understand so considerably its pretty much tough to argue with you (not that I truly would want…HaHa). You certainly put a brand new spin on a topic thats been written about for years. Wonderful stuff, just good!

  10. Morning, i really think i will be back to your page

  11. Me like, will read more. Thanks!

  12. You got yourself a new rader.

  13. I like this site because so much useful stuff on here : D.

  14. Please let me know if you’re looking for a writer for your site. You have some really good posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Thank you!

  15. I am not rattling great with English but I get hold this really easygoing to read .

  16. getmoneyrp says:

    I like this website its a master peace ! Glad I found this on google .

  17. engineering says:

    696477 492775Is gonna be back steadily to check up on new posts 15966

  18. I was looking at some of your articles on this site and I believe this internet site is really instructive! Keep on posting .

  19. I was talking to a good friend of my own on this article and even about upvc doors too. I do think you made a lot of good points here, we’re excited to keep reading information from you.

  20. karaj says:

    I am typically to running a blog and i really respect your content. The article has really peaks my interest. I am going to bookmark your web site and keep checking for brand new information.

  21. Hey can you tell me which platform you’re dealing with? I’m seeking to start out my website on Arvind Pandit Kansas in the future yet I’m having a tough time deciding.

  22. You are absolutely right! I really liked looking through this and I will come back for more right away. My website is on bluestacks free download, you could take a glance if you’re still interested in that.

  23. There are actually awesome improvements on the design of the page, I definitely love it. My site is on the subject of opera mini windows and generally there are quite a lot of stuff to be done, I’m currently a newcomer in web design. Take good care!

  24. I’m truly loving the theme of your site. Do you ever encounter any internet browser interface troubles? A few of my own blog audience have lamented concerning my 9apps java website not operating correctly in Explorer yet seems amazing in Chrome. Have you got any advice to help repair this issue?

  25. I just arrived right here via some other web page about download kik and considered I should look into this. I adore what I see so I am just following you. Looking towards looking at your site all over again.

  26. Darwin Horan says:

    Thanks a lot for sharing this, I bookmarked the website. I am also attempting to find guidance about real estate agents, have you any idea exactly where I can come across one thing such as that? I’ll come back quickly!

  27. Howdy, what do you feel with regards to wireless intercom? Extremely impressive topic, huh?

  28. Elliott says:

    I found your blog site on google and check several of one’s early posts. Continue to keep up the pretty superior operate. I just extra up your RSS feed to my MSN News Reader. Seeking forward to reading a lot more from you later on!

  29. bing bring me here. Thanks!

  30. click here says:

    Hello! This is my very first reply on your website so I really wanted to say a quick hello and tell you I truly enjoy reading your posts. Can you recommend other sites which go over kik pc? I’m also truly keen on this! Thank you!

  31. I just came right here from some other website on the subject of more followers on instagram and thought I may as well read this. I love what I see therefore I am just following you. Looking forward to looking at your website back again.

  32. Our LGV (Large Goods Vehicle) HGV training is based in East London, and our LGV/ HGV courses are taught by qualified DVSA LGV & HGV trainers. LGV was formerly known as HGV, where it used to be referred to as HGV Class 2 (now called LGV Category C) and HGV class 1 (Now called LGV Category C+E).

  33. I’m interested to find out just what website system you’re utilizing? I am experiencing several small protection difficulties with the latest blog on 4k movies online so I would love to find a thing far more secure. Do you have any recommendations?

  34. I came right here via another page about motorcycle injury lawyer and considered I should check out this page. I like what I see therefore I am just following you. Looking towards exploring your site back again.

  35. Pokemon go working android apk hacks download says:

    I’m interested to know which site system you are using? I am having a few small protection challenges with my most recent blog regarding pokemon apps for android and I would love to find something far more safe. Do you have any solutions?

  36. 552582 767274I discovered your blog post web web site on the search engines and appearance several of your early posts. Always sustain the top notch operate. I additional the Feed to my MSN News Reader. Seeking forward to reading significantly far more on your part down the line! 687727

  37. Hey there! I recently came across this amazing site and I truly like it. I also love to speak about best ethereum exchange sometimes. Great to be around, thank you!

  38. I constantly read through your posts closely. I’m likewise looking into cheap lawn mowers, maybe you might discuss that from time to time. I will be back.

  39. I’m actually enjoying the theme/design of your information site. Do you ever come across any kind of browser compatibility situations? Quite a few of the blog audience have complained about my heat pumps for sale blog not operating properly in Internet Explorer yet seems fantastic in Safari. Have you got any kind of advice to assist repair that problem?

  40. Hey there! This is my first comment on your website so I simply wanted to say a quick hello and tell you I genuinely enjoy reading your blog posts. Can you recommend other blogs that deal with online movies? I’m as well particularly interested in this! Thanks a ton!

  41. You’re absolutely correct. I enjoyed looking through this article and I will get back for more as soon as possible. My own website is about canon printer scanner, you might take a look if you happen to be interested in that.

  42. I’m really curious to understand which website system you are working with? I am experiencing some slight security problems with the most recent blog dealing with bitcoin debit card and I would like to find something much more risk-free. Are there any recommendations?

  43. ÈÇÑÈí says:

    You are absolutely correct! I really liked reviewing this and I will certainly come back for more immediately. My own website is about web games, you might have a look if you happen to be interested in that.

  44. iraq Seo says:

    151220 561421Can I just now say that of a relief to locate somebody who truly knows what theyre speaking about online. You in fact know how to bring a difficulty to light and function out it crucial. The diet want to see this and appreciate this side on the story. I cant believe youre no more popular since you surely possess the gift. 966882

  45. I am truly enjoying the design of your internet site. Do you encounter any web browser compatibility problems? A number of my own site audience have complained about my international freight forwarders site not working effectively in Internet Explorer but looks excellent in Opera. Are there any tips to assist repair this situation?

  46. I just arrived over here from a different web address on the subject of shipping rates and considered I might as well check out this page. I like what I see thus now I am following you. Looking towards exploring the site back again.

  47. 289014 859272You know, many people are looking around for this information, you can help them greatly. 264519

  48. Howdy can you inform me which blog platform you are working with? I am going to start our website on mesothelioma attorney blog in the near future though I’m having a tough time making a choice.

  49. I like the things you dudes are now up to. This sort of smart work and reporting! Keep up the wonderful effort friends, I’ve incorporated you to my own how to watch free movies online site.

Leave a Reply

Your email address will not be published.