xml data or other?

rusi rustompmody at gmail.com
Fri Nov 9 08:50:15 EST 2012


On Nov 9, 5:54 pm, Artie Ziff <artie.z... at gmail.com> wrote:
> Hello,
>
> I want to process XML-like data like this:
<snipped>
> Edits were substituting '/' for '\' on the end tags, and adding the
> following structure:

If thats all you want, you can try the following:

# obviously this should come from a file
input= """<testname=ltpacpi.sh>
        <description>
                ACPI (Advanced Control Power & Integration) testscript
for 2.5 kernels.

        <\description>
        <test_location>
                ltp/testcases/kernel/device-drivers/acpi/ltpacpi.sh
        <\test_location>
<\testname>"""

prefix = """<?xml version="1.0"?>
<data>
"""

postfix = """</data>"""

correctedInput = prefix + input.replace("\\", "/") + postfix
# submit correctedinput to etree



More information about the Python-list mailing list