Author: bugman Date: Sun Jun 22 18:00:33 2008 New Revision: 6418 URL: http://svn.gna.org/viewcvs/relax?rev=6418&view=rev Log: Shifted the contents of create_top_level() into Relax_data_store.xml_write(). Modified: 1.3/data/__init__.py 1.3/data/relax_xml.py Modified: 1.3/data/__init__.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/__init__.py?rev=6418&r1=6417&r2=6418&view=diff ============================================================================== --- 1.3/data/__init__.py (original) +++ 1.3/data/__init__.py Sun Jun 22 18:00:33 2008 @@ -33,6 +33,7 @@ # relax module imports. from pipe_container import PipeContainer from relax_errors import RelaxPipeError +from version import version __all__ = [ 'data_classes', @@ -162,6 +163,10 @@ def xml_write(self, file): """Create a XML document representation of the current data pipe. + This method creates the top level XML document including all the information needed + about relax, calls the PipeContainer.xml_write() method to fill in the document contents, + and writes the XML into the file object. + @param file: The open file object. @type file: file """ @@ -169,11 +174,17 @@ # Create the XML document object. xmldoc = xml.dom.minidom.Document() - # Create the top level element. - top_elem = create_top_level(xmldoc) + # Create the top level element, including the relax URL. + top_elem = xmldoc.createElementNS('http://nmr-relax.com', 'relax') + + # Append the element. + xmldoc.appendChild(top_elem) + + # Set the relax version number. + top_elem.setAttribute('version', version) # Create the data pipe element. - create_pipe_elem(xmldoc, top_elem) + self[self.current_pipe].xml_write(xmldoc, top_elem) # Write out the XML file. xml.dom.ext.PrettyPrint(xmldoc, file) Modified: 1.3/data/relax_xml.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/relax_xml.py?rev=6418&r1=6417&r2=6418&view=diff ============================================================================== --- 1.3/data/relax_xml.py (original) +++ 1.3/data/relax_xml.py Sun Jun 22 18:00:33 2008 @@ -25,9 +25,6 @@ # Python module imports. from re import search - -# relax module imports. -from version import version def create_diff_elem(doc, elem): @@ -118,28 +115,6 @@ str_elem.setAttribute('id', ds[ds.current_pipe].structure.id) -def create_top_level(doc): - """Create the top level XML element including all the information needed about relax. - - @param doc: The XML document object. - @type doc: xml.dom.minidom.Document instance - @return: The top level relax element. - @rtype: XML element object - """ - - # Create the element, including the relax URL. - top_elem = doc.createElementNS('http://nmr-relax.com', 'relax') - - # Append the element. - doc.appendChild(top_elem) - - # Set the relax version number. - top_elem.setAttribute('version', version) - - # Return the element. - return top_elem - - def fill_object_contents(doc, elem, object=None, blacklist=None): """Place all simple python objects into the XML element namespace.