Skip to content
Prev 366785 / 398502 Next

XML to CSV

They are attributes, not nodes so, if I understood the question:

"//DischargeMedication/Medication/@MedAdmin"
"//DischargeMedication/Medication/@MedID"

should do.
HTH, 
Gabriele


From: Andrew Lachance [mailto:alachanc at bates.edu] 
Sent: Wednesday, January 25, 2017 3:12 PM
To: Franzini, Gabriele [Nervianoms]
Cc: r-help at r-project.org
Subject: Re: [R] XML to CSV

Hello all,

Thank you for the extremely helpful information. As a follow up, some of the nested elements are of the form below:
-<DischargeMedication>
? ? <Medication MedAdmin="0" MedID="10"/>
? ? <Medication MedAdmin="0" MedID="11"/>

I've been having trouble extracting this information and was wondering if anyone had any suggestions.

Thank you,
Andrew
On Thu, Jan 5, 2017 at 7:39 AM, Franzini, Gabriele [Nervianoms] <Gabriele.Franzini at nervianoms.com> wrote:
Hello Andrew,

as you are "clean slate" anyway in handling XML files, you could take a look to XSLT processing -- also an off-topic area.
There are free tools available around, and many examples of "XML to CSV XSLT" on StackOverflow.

HTH,
Gabriele

-----Original Message-----
On January 4, 2017 12:45:08 PM PST, Ben Tupper <btupper at bigelow.org> wrote: