Complete a program that is designed to read an XMl file, follow an XPath to a selected node, and then list all of the text content (ignoring attributes) in the subtree rooted at the selected node, in the order that the text appeared within the original XML file.

You will be provided with the bulk of the code for this program, including the input processing to read XML and convert it into a tree structure (declared in node.h).

Your task is to supply the functions declared in extraction.h:

  1. A function to walk the tree starting from its root, following an XPath to a desired node.
  2. A function to extract all of the text (in the leaves of the tree) in the tree, combining it into a single string with one or more blanks separating the text strings from different nodes.

Your bodies for these functions should be written in extraction.cpp.

To run the application program, supply two command line parameters. The first will designate an XML file and the second will be the XPath to the desired node.

Example 1

./xmlextract test0.html /html/body

will print

Hello world!

Example 2

./xmlextract test1.html /html/body/p[2]

will print

world!

Example 3

./xmlextract books1.xml /rdf:RDF/pgterms:etext/dc:creator

will print

Twain, Mark, 1835-1910

Example 4

./xmlextract books1.xml /rdf:RDF/pgterms:etext[3]

will print

&pg; A History of the Early Part of the Reign of James the Second Fox, Charles
James, 1749-1806 Morley, Henry, 1822-1894 [Editor] A History of the Early Part
of the Reign of James en Great Britain -- History -- James II, 1685-1688 DA
2003-07-01 17

Please only submit new extraction.cpp file with the bodies fot the two missing functions!