P
peterbe
I have an XML string coming in from one system that I'd like to tidy up
and return in a very particular format. I'm picky!
If the input is
<SOMETHING attr1="foo1"
attr2='foo2' >
Then the output must be
<something
attr1="foo1"
attr2="foo2">
The file might have comments and namespaces and all of this should be
preserved as it was when it came in.
I was hoping to use ElementTree which can parse my input so that I rest
on solid foundations instead of mad regular expressions and string
manipulation.
But, if mad regular expressions and string manipulations is what it
takes I'll have to settle on that.
What are my options?
and return in a very particular format. I'm picky!
If the input is
<SOMETHING attr1="foo1"
attr2='foo2' >
Then the output must be
<something
attr1="foo1"
attr2="foo2">
The file might have comments and namespaces and all of this should be
preserved as it was when it came in.
I was hoping to use ElementTree which can parse my input so that I rest
on solid foundations instead of mad regular expressions and string
manipulation.
But, if mad regular expressions and string manipulations is what it
takes I'll have to settle on that.
What are my options?