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

  • SEARCH
  • Home
  • 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 8841243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:39:55+00:00 2026-06-14T10:39:55+00:00

supposing O have these two equivalent (at least they are supposed to be) XML

  • 0

supposing O have these two equivalent (at least they are supposed to be) XML schemas. The actual XML will eventually be parsed by C#. I think the second way is ‘more correct’ since I will get attributes as actual attrbutes, instead of child elements, correct?

<?xml version="1.0" encoding="ISO-8859-1"?>
<switch>
  <switch_name>switch1</switch_name>
  <software_version>1</software_version>
  <vendor>Cisco</vendor>
  <ip_address>1.1.1.1</ipaddress>
  <linecard>
    <model_type>12345</model_type>
 <fcport>
 <slot> 1</slot>
 <port> 1</port>
 <speed>4</speed>
 </fcport>

  </linecard>
</switch>

<switch>
 <switch name="switch1" version="1" vendor="Cisco" ip_address="1.1.1.1">
     <linecard model="12345">
  <fcport slot="1" port="1" speed="4">
</fcport>
<linecard>
</switch>
</xml>
  • 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. Editorial Team
    Editorial Team
    2026-06-14T10:39:57+00:00Added an answer on June 14, 2026 at 10:39 am

    Neither one is strictly more “correct” than the other, both will work for your example. Neither breaks any rules.

    That said, I think I agree with W3Schools on this one, in that data should go inside child elements rather than attributes. Especially things like IP addresses just FEEL like data that should be a child element rather than an attribute. Attributes I typically use for metadata, such as auto generated IDs.

    This is especially true if you later want to account for expansion — for example, what if you want to associate multiple IPs? With child elements you can just add another element, but with attributes you have to come up with a new attribute name for each addition (ip1, ip2, ip3…).

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

Sidebar

Related Questions

MVC newbie question re binders. Supposing I have two strongly typed partial actions that
Supposing I have two different languages for Localizable.strings and a single target. There's any
I have a form that has two views. These views are controlled by radio
supposing to have two arrays a[N],b[N] containing only 0 and 1 values, is there
Supposing that I have two TextBlock elements, one being a label for the second,
I have two urls: blah.com/workorder/{dealer_code} blah.com/workorder/{cust_id} Both of these return a workorder based on
Supposing I have two collections, posts and comments. post = { _id: 1, language:
Supposing I have two entities a parent object and a child. I want the
There are two tables: table A and table B. They have the same columns
Supposing I have two classes, Customer and Order, where one Customer can have one-or-many

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.