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
Your task is to supply the functions declared in
- A function to walk the tree starting from its root, following an XPath to a desired node.
- 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
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.
./xmlextract test0.html /html/body
./xmlextract test1.html /html/body/p
./xmlextract books1.xml /rdf:RDF/pgterms:etext/dc:creator
Twain, Mark, 1835-1910
./xmlextract books1.xml /rdf:RDF/pgterms:etext
&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!