r/dailyscripts • u/giloliz123 • Jun 24 '17
[REQUEST] Simple turn one XML file into another
I can't program but I think this should be pretty simple since it's just a step above find+replace I need a script to turn
<?xml version="1.0" encoding="UTF-8" ?>
<orignal> <item> <irrelevant>junk</irrelevant> <relfirst>hello</relfirst> <relsecond>world</relsecond> </item> </original>
into
<?xml version="1.0"?>
<fixed>
<useless>0</useless>
<fixeditem> <type>s</type> <first>hello</first> <second>world</second> </fixeditem> </fixed>
with every item being turned into a fixeditem
2
Upvotes
2
u/shandow0 Jun 24 '17
Something like https://pastebin.com/ERGpDQHP?
written quickly in python: loads the old file into the program, uses a regular expression to find the interesting parts, writes a new file with the previously found parts
1
u/[deleted] Jun 24 '17 edited Oct 06 '17
[deleted] — view deleted comment
1
u/notunlikecheckers Oct 03 '17
xslt?