Tengo este xml, lo que necesito es concatenar en un string en python 3.7, el titulo (lo que esta el la etiqueta "fileDesc title") y el contenido (lo que esta en la etiqueta "raw") ¿Alguien sabe como hacerlo? Gracias
<?xml version="1.0" encoding="UTF-8"?>
<NAF xml:lang="en" version="v3">
<nafHeader>
<fileDesc title="William Beaumont and the Human Digestion" />
<public publicId="d001" uri="http://blog.yovisto.com/william-beaumont-and-the-human-digestion/" />
</nafHeader>
<raw><![CDATA[William Beaumont and the Human Digestion.
William Beaumont: Physiology of digestion Image Source. On November 21, 1785, US-American surgeon William Beaumont was born. He became best known as “Father of Gastric Physiology†following his research on human digestion. William Beaumont was born in Lebanon, Connecticut and became a physician. He served as a surgeon’s mate in the Army during the War of 1812. He opened a private practice in Plattsburgh, New York, but rejoined the Army as a surgeon in 1819. Beaumont was stationed at Fort Mackinac on Mackinac Island in Michigan in the early 1820s when it existed to protect the interests of the American Fur Company. The fort became the refuge for a wounded 19-year-old French-Canadian fur trader named Alexis St. Martin when a shotgun went off by accident in the American Fur Company store at close range June 6th, 1822. St. Martin’s wound was quite serious because his stomach was perforated and several ribs were broken. Nobody really expected that the young man would survive but he really did. The skin around St. Martin’s wound fused to the hole in his stomach, leaving a permanent opening – a gastric fistula. [1] Beaumont quickly noticed that there was much research potential. Back then, not too much was known about the digestive system. In order to gain more information, Beaumont performed numerous experiments on St. Martin over a period of eight years. The experiments must have been really uncomfortable for the man, who was inserted bits of different foods tied to strings through the hole in his stomach, pulling them out periodically to observe digestion. Beaumont also removed gastric juice, examining it to better understand its nature. Beaumont became the “Father of Gastric Physiology†and his findings were published in the book “Experiments and Observations on the Gastric Juice and the Physiology of Digestion†in 1833. The work is now considered as the basis of much of the early knowledge on digestion. William Beaumont discovered that hydrochloric acid is the main chemical responsible for breaking down food and he suggested that another important digestive chemical, which is now known as pepsin. He suggested that digestion is a chemical process, not merely a mechanical one caused by stomach muscle movement. Also, Beaumont gave insights on how emotions, temperature, and physical activity can affect digestion. Beaumont’s famous patient, St. Martin, outlived the scientist even though his wound never completely healed. He had several children and died at the age of 83. [2] At yovisto, you may be interested in a video lecture on The Digestive System.]]></raw>
</NAF>
He intentado usar xml.etree.ElementTree.XML
pero no consigo obtener el contenido de la etiqueta <raw>
:
import xml.etree.ElementTree as ET
tree = ET.parse(r'C:\Users\super\Desktop\documentos\wes2015.d001.naf')
root = tree.getroot()
for elem in root:
for subelem in elem.findall('*'):
print(subelem.attrib)