12

I want to get or return the number of item(<recROw></recROw>) in an xml file using the XQUERY. Is there an easy way to do that in XQuery?

Here is my sample XML data:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<DailyRecord>
  <recROw>
    <id>1</id>
    <name>John Smith</name>
    <gender>male</gender>
    <status>active</status>
  </recROw>
  <recROw>
    <id>2</id>
    <name>James Bond</name>
    <gender>male</gender>
    <status>active</status>
  </recROw>
<DailyRecord>

Any help and ideas would be appreciated. Thank you in advance!

napstyr maceda
  • 179
  • 3
  • 13

1 Answers1

3

Try

count(/DailyRecord/recROw)
Michael J Swart
  • 3,060
  • 3
  • 29
  • 46
Michael Kay
  • 156,231
  • 11
  • 92
  • 164