Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-12-02 Thread Adam Funk
On 2011-11-29, Stefan Behnel wrote: > Adam Funk, 29.11.2011 13:57: >> On 2011-11-28, Stefan Behnel wrote: >>> If the name "big_json" is supposed to hint at a large set of data, you may >>> want to use something other than minidom. Take a look at the >>> xml.etree.cElementTree module instead, whic

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-29 Thread Stefan Behnel
Adam Funk, 29.11.2011 13:57: On 2011-11-28, Stefan Behnel wrote: Adam Funk, 25.11.2011 14:50: Then I recurse through the contents of big_json to build an instance of xml.dom.minidom.Document (the recursion includes some code to rewrite dict keys as valid element names if necessary) If the nam

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-29 Thread Adam Funk
On 2011-11-28, Steven D'Aprano wrote: > On Fri, 25 Nov 2011 13:50:01 +, Adam Funk wrote: > >> I'm converting JSON data to XML using the standard library's json and >> xml.dom.minidom modules. I get the input this way: >> >> input_source = codecs.open(input_file, 'rb', encoding='UTF-8', >> er

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-29 Thread Adam Funk
On 2011-11-28, Stefan Behnel wrote: > Adam Funk, 25.11.2011 14:50: >> I'm converting JSON data to XML using the standard library's json and >> xml.dom.minidom modules. I get the input this way: >> >> input_source = codecs.open(input_file, 'rb', encoding='UTF-8', >> errors='replace') > > It doesn

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-28 Thread Stefan Behnel
Adam Funk, 25.11.2011 14:50: I'm converting JSON data to XML using the standard library's json and xml.dom.minidom modules. I get the input this way: input_source = codecs.open(input_file, 'rb', encoding='UTF-8', errors='replace') It doesn't make sense to use codecs.open() with a "b" mode.

Re: suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-28 Thread Steven D'Aprano
On Fri, 25 Nov 2011 13:50:01 +, Adam Funk wrote: > I'm converting JSON data to XML using the standard library's json and > xml.dom.minidom modules. I get the input this way: > > input_source = codecs.open(input_file, 'rb', encoding='UTF-8', > errors='replace') big_json = json.load(input_sour

suppressing bad characters in output PCDATA (converting JSON to XML)

2011-11-25 Thread Adam Funk
I'm converting JSON data to XML using the standard library's json and xml.dom.minidom modules. I get the input this way: input_source = codecs.open(input_file, 'rb', encoding='UTF-8', errors='replace') big_json = json.load(input_source) input_source.close() Then I recurse through the contents of