Author: bugman Date: Sun Jun 22 17:52:11 2008 New Revision: 6417 URL: http://svn.gna.org/viewcvs/relax?rev=6417&view=rev Log: Shifted most of the PipeContainer.xml_write() method to the Relax_data_store.xml_write() method. Modified: 1.3/data/__init__.py 1.3/data/pipe_container.py 1.3/generic_fns/results.py Modified: 1.3/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/__init__.py?rev=6417&r1=6416&r2=6417&view=diff ============================================================================== --- 1.3/data/__init__.py (original) +++ 1.3/data/__init__.py Sun Jun 22 17:52:11 2008 @@ -27,6 +27,8 @@ # Python module imports. from re import search from string import split +import xml.dom.ext +import xml.dom.minidom # relax module imports. from pipe_container import PipeContainer @@ -155,3 +157,28 @@ # Change the current data pipe. self.current_pipe = pipe_name + + + def xml_write(self, file): + """Create a XML document representation of the current data pipe. + + @param file: The open file object. + @type file: file + """ + + # Create the XML document object. + xmldoc = xml.dom.minidom.Document() + + # Create the top level element. + top_elem = create_top_level(xmldoc) + + # Create the data pipe element. + create_pipe_elem(xmldoc, top_elem) + + # Write out the XML file. + xml.dom.ext.PrettyPrint(xmldoc, file) + + # Print out. + print self + print "\n\nXML:" + xml.dom.ext.PrettyPrint(xmldoc) Modified: 1.3/data/pipe_container.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/pipe_container.py?rev=6417&r1=6416&r2=6417&view=diff ============================================================================== --- 1.3/data/pipe_container.py (original) +++ 1.3/data/pipe_container.py Sun Jun 22 17:52:11 2008 @@ -22,8 +22,6 @@ # Python module imports. from re import match -import xml.dom.ext -import xml.dom.minidom # relax module imports. from data_classes import Element @@ -134,20 +132,11 @@ def xml_write(self, file): - """Create a XML document representation of the current data pipe. + """Create a XML elements for the current data pipe. @param file: The open file object. @type file: file """ - - # Create the XML document object. - xmldoc = xml.dom.minidom.Document() - - # Create the top level element. - top_elem = create_top_level(xmldoc) - - # Create the data pipe element. - pipe_elem = create_pipe_elem(xmldoc, top_elem) # Add all simple python objects within the PipeContainer to the global element. global_elem = xmldoc.createElement('global') @@ -165,11 +154,3 @@ # Add the structural data, if it exists. if hasattr(cdp, 'structure'): create_str_elem(xmldoc, pipe_elem) - - # Write out the XML file. - xml.dom.ext.PrettyPrint(xmldoc, file) - - # Print out. - print self - print "\n\nXML:" - xml.dom.ext.PrettyPrint(xmldoc) Modified: 1.3/generic_fns/results.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/results.py?rev=6417&r1=6416&r2=6417&view=diff ============================================================================== --- 1.3/generic_fns/results.py (original) +++ 1.3/generic_fns/results.py Sun Jun 22 17:52:11 2008 @@ -63,7 +63,7 @@ # Specific results writing function. if format == 'xml': - self.write_function = ds[ds.current_pipe].xml_write + self.write_function = ds.xml_write elif format == 'columnar': self.write_function = self.relax.specific_setup.setup('write_columnar_results', function_type, raise_error=0) else: @@ -86,7 +86,7 @@ # Specific results writing function. if format == 'xml': - read_function = ds[ds.current_pipe].xml_read + read_function = ds.xml_read elif format == 'columnar': read_function = get_specific_fn('read_columnar_results', ds[ds.current_pipe].pipe_type, raise_error=False) else: @@ -127,7 +127,7 @@ # Specific results writing function. if format == 'xml': - write_function = ds[ds.current_pipe].xml_write + write_function = ds.xml_write elif format == 'columnar': write_function = get_specific_fn('write_columnar_results', ds[ds.current_pipe].pipe_type, raise_error=False) else: