Solved

How can I count records in an XML file

Posted on 2014-11-30
6
1,161 Views
Last Modified: 2014-12-03
How can I count records in an XML file
0
Comment
Question by:lux sat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:lux sat
ID: 40472849
How can I count RECORDS in an XML file
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40472862
XML represent a tree structure of nodes called "elements". You can count then (or, say, number of elements on each tree level, or something else related to the number of elements) using nearly any XML parser.

What language are you working with?
0
 

Author Comment

by:lux sat
ID: 40476291
<xml>
<candidates>
      <candidate>
                 <name>Record 1</name>
                 <address>address 1</address>
        </candidate>
         <candidate>
                 <name>Record 2</name>
                 <address>Address 2</address>
        </candidate>
    </candidates>
</xml>

From the above XML code I want to count the number of candidate <Candidate></Candidate>(The above has 2 records and I want to count for a long file that I have).

THANKS,
Lakshmi
1
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 36

Expert Comment

by:mccarl
ID: 40477432
Yes, that is helpful yet in order for us to provide any sort of help you still need to answer eghtebas's question...
What language are you working with?
0
 

Author Comment

by:lux sat
ID: 40477744
I have loaded the XML file data into ACCESS database . I have about 1800 records in my Access table. Just wanted to know if the count is correct from the XML file.
0
 
LVL 36

Accepted Solution

by:
mccarl earned 500 total points
ID: 40477902
Ok, so you probably just need something like UltraEdit (or maybe Notepad+ might work, but regular Notepad and Wordpad won't) and then you can use the "Find" feature from the menu or Ctrl+F and enter     <candidate>     as the search term (including the <  > ) and UltraEdit has a "Count All" button in the find dialog. This count should line up with the number of candidate elements because there is exactly 1   <candidate>   string per element. Note that </candidate> and <candidates> won't be counted as long as you search as I said above, ie. include the <  > characters around candidate.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question