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 6719969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:09:22+00:00 2026-05-26T09:09:22+00:00

Though I know a little about XML and XML Schema I haven’t used it

  • 0

Though I know a little about XML and XML Schema I haven’t used it in ages and have never been particularly competent in its use.
Therefore a little help with the following would be really appreciated.

We currently receive delimited data files and would like to switch to XML files validated by an XML Schema.
The current delimited file contains a trailer record that includes a record count.

e.g.: TRL0000155

In the XML version, should this record count be included as an attribute of the main <data_file> element

 <data_file record_count="155">
    <record>
       record XML...
    </record>
    <record>
       record XML...
    </record>
    ...
 </data_file>

or as a child element of <data_file>

<data_file>
   <record_count>155</record_count>
   <record>
      record XML...
   </record>
   <record>
      record XML...
   </record>
   ...
<data_file>

or perhaps I am going about it all wrong and you could give me a tip on the correct method for replacing the record count entirely.

I do recognise the difference between elements and attributes but in this case I am hoping it’s an issue that many have come across before and can offer a good explaination of why one is the preferred solution.

FWIW I am leaning more towards the attribute solution as the count is metadata about the <data_file> element but am happy to follow more expert instruction.

Thanks in advance…

  • 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-05-26T09:09:22+00:00Added an answer on May 26, 2026 at 9:09 am

    Since you have a <record> element for each record, there’s technically no need for the record count to be explicit. You can still have it, of course, for example if it helps performance. But on the other hand, it introduces the issue that it has to be kept consistent with the number of <record> elements.

    If you do decide to store the record count, both of your approaches (attribute and element) are ok. The main difference is that when you (if you) build the string content of the file, attributes are ignored, while the text nodes in the elements are not. So the count would show up in the second case but not in the first.

    If you can apply XPath to the XML file, determining the record cound is easy; that would just be count(/data_file/record). In that case there’s really no need to store the value explicitly.

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

Sidebar

Related Questions

The code here is X++. I know very little about it, though I am
I have very little idea about mobile platforms, though I am interested to program
I know little about sockets but so far I haven't had much of a
You know the one I am talking about. We have all been there at
I have been thinking a little about environment variables and have a few questions/observations.
I am new to Perl, but I know a little bit of C though.
I know this topic has been beaten to death a little on SO, but
The ways I know about so far are Create an ant build.xml file, make
I know VERY little about UNIX commands, so I´ll do my best to explain
For a C# UserControl on Windows Mobile (though please answer if you know it

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.