In C#, you can use XLinq OR XPath, to query the document quickly. and for the xpath, just load one document, then pass the xpath expression to invoke the methods, you get the results.
here is one basic document,
<?xml version="1.0" encoding="UTF-8"?>
If we need to get the sum of all items, we can use the xpath as sum(//item/amount)
in C#, here is the code, let’s assume the document are located in order.xml
or using xpath,
both outputs 310 here,
if use java, code will be more complicated. here is one sample using the DOM and Xpath in java
that’s java, more codes to do the same thing compared with C#.