Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 96771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:52:38+00:00 2026-05-10T23:52:38+00:00

Which would be the correct format for this XML data, are they equivalent or

  • 0

Which would be the correct format for this XML data, are they equivalent or are there trade offs between the two?

1.

<sitemap>   <category name='Animals'>     <section title='Dogs'>       <page url='/pics/greatdane.jpg' title='Great Dane'/>     </section>   </category> </sitemap> 

2.

<sitemap>   <page>     <category>Animals</category>     <section>Dogs</section>     <title>Great Dane</title>     <url>/pics/greatdane.jpg</url>       </page> </sitemap> 

I’ve implemented the first example with my style sheet and it seems to work fine, but I’m unsure what the correct form should be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:52:38+00:00Added an answer on May 10, 2026 at 11:52 pm

    The issue of attributes vs elements has been around for the better part of a decade and there is no right answer. Instead consider the differences and from that you should be able to decide which to use:

    • There can be only one instance of an attribute although you can enforce this with elements using DTD or XML Schema;
    • Attributes are unordered. Elements are not;
    • Attributes lead to a more concise syntax if there are no children. Compare:

      <page name=’Sitemap’/>

    to:

    <page>   <name>Sitemap</name> </page> 

    I know which one I prefer;

    • Not really relevant now since DTDs aren’t used much (if at all) over XML Schema but I’ll add it anyway: DTDs allow default values (implied) for attributes but no such mechanism for elements; and
    • Elements, being elementss, can have children and attributes of their own. Attributes obviously cannot.

    So, from your example, your innermost <page> element has a URL attribute (although it’s an image for some reason–perhaps a preview icon? If so the attribute name is misleading). A webpage only has one URL (generally) so that’d be a good example of something that could be an attribute.

    If on the other hand you wanted to list the images on the page, there could obviously be more than one so you’d need elements for that.

    But, in the end, most of the time there’s no right or wrong answer and it’s largely a question of style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 179k
  • Answers 179k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In your AddWell function, you're passing the record by value.… May 12, 2026 at 3:54 pm
  • Editorial Team
    Editorial Team added an answer select users.id from users join sales on /* your join… May 12, 2026 at 3:54 pm
  • Editorial Team
    Editorial Team added an answer As long as its only your applet communicating with the… May 12, 2026 at 3:54 pm

Related Questions

I'm designing a system which is receiving data from a number of partners in
Using Flex 3.2, I have a object which extends a TitleWindow. In this TitleWindow
Is there anything similar to getElementById in actionscript? I'm trying to make a prototype
Which XML validation tools can you recommend for both performance and accuracy, each of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.