Skip to content

devasudanT/count_verses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Bible Verse Counter

A Python script that counts the total number of verses in an XML-formatted Bible file (RVIC.xml) and compares it with the expected count of 31,102 verses.

Overview

This script parses an XML Bible file using the ElementTree library and traverses through its structure to count verses. It's designed to work with XML files that follow a specific hierarchical structure where books contain chapters, and chapters contain verses.

Features

  • XML parsing using ElementTree
  • Hierarchical traversal of Bible structure
  • Verse counting validation
  • Error handling

Requirements

  • Python 3.x
  • XML Bible file (RVIC.xml)

Usage

python count_verses.py

Expected Output

Total number of verses found: 31102
Expected number of verses: 31,102
Matches expected count: True

Process Flow

graph TD
    A[Start] --> B[Parse XML File]
    B --> C[Initialize Verse Counter]
    C --> D[Iterate Through Books]
    D --> E[Iterate Through Chapters]
    E --> F[Count Verses in Chapter]
    F --> G{More Chapters?}
    G -->|Yes| E
    G -->|No| H{More Books?}
    H -->|Yes| D
    H -->|No| I[Display Results]
    I --> J[Compare with Expected Count]
    J --> K[End]

    style A fill:#98FB98
    style K fill:#FF6B6B
    style I fill:#87CEEB
    style J fill:#87CEEB
Loading

XML Structure

The script expects the Bible XML file to follow this structure:

<bible>
    <b> <!-- Book -->
        <c> <!-- Chapter -->
            <v>Verse content</v>
        </c>
    </b>
</bible>

Error Handling

The script includes error handling to catch and display any issues that might occur during:

  • File reading
  • XML parsing
  • Tree traversal

Validation

The script validates the count against the known number of verses in the Bible (31,102) and reports whether the counts match.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages