We use cookies and other tools to enhance your experience on our website and to analyze our web traffic.
For more information about these cookies and the data collected, please refer to our Privacy Policy.

Parsing XML/Profusion Files

1 post
Was this reply useful? Learn more...
 
[-]
razallon +0 points · over 6 years ago

I am having troubles parsing the XML and profusion files. I have been using codes from stack overflow and stack abuse, and with both codes I am getting stuck at the "items" and "names" portion. I looked closely at the XML file and have come to the hypothesis that python is unable to detect the items. How should I fix this problem?

I took the code from this website: http://stackabuse.com/reading-and-writing-xml-files-in-python/

I ran the following code.

tree = ET.parse('shhs1-200001-nsrr.xml') root = tree.getroot() for child in root: print(child.tag, child.attrib)

and I got the following result: SoftwareVersion {} EpochLength {} ScoredEvents {}

442 posts
bio
Was this reply useful? Learn more...
 
[-]
mrueschman +0 points · about 6 years ago

What are you trying to do once you parse the XML annotation files?

I don't use python, but I did something in R a couple years ago: https://sleepdata.org/tools/mrueschman-xml-annotation-extractor

Another example in Ruby: https://sleepdata.org/tools/ruby-script-tutorial-05