sid5432 / pyOTDR

Simple OTDR SOR file parser written in Python
GNU General Public License v3.0
71 stars 28 forks source link

new feature request : xml output #1

Closed macdoor closed 7 years ago

macdoor commented 7 years ago

please add xml file output option. xml is more post processing friendly

sid5432 commented 7 years ago

Interesting thought. I'll try to get to it in the next few weeks (but no promises!).

macdoor commented 7 years ago

great! I also made some modifications by myself. I tried to use lazyxml to dump xml. like this print >>logfile, lazyxml.dumps(results, cdata=False, indent=' ' * 4, root='sor') But I encountered a serious problem, There are whitespaces in xml tags. <build condition>BC (as-built)</build condition> So I can not get valid xml output.

sid5432 commented 7 years ago

Good solution using lazyxml. To fix the whitespace problem, I have added short function to substitute all the problematic characters with an underscore ('_') character.