This is a Go application that parses an XML file or an XML response from a URL, counts the child nodes for each XML element, and prints the counts to the console.
- Make sure you have Go installed on your machine.
- Clone this repository or copy the source code into your working directory.
- Build the project using the following command:
go build -o sir
The application accepts a single argument that specifies the path to an XML file or a URL containing an XML response.
./sir <filepath/url>-
Processing a local XML file:
./sir sample.xml
-
Processing an XML from a URL:
./sir https://example.com/sample.xml
For an input XML file or URL containing:
<root>
<child1>
<subchild1 />
</child1>
<child2 />
</root>The output will be:
root: 2
child1: 1