Solved

How can I count records in an XML file

Posted on 2014-11-30
6
436 Views
Last Modified: 2014-12-03
How can I count records in an XML file
0
Comment
Question by:lux sat
  • 3
  • 2
6 Comments
 

Author Comment

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

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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 35

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 35

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
modifying sharepoint search results 13 30
cleaning xml string 2 47
asp.net, auto populate 6 49
json format text only 4 65
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now