NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 366

Show
Ignore:
Timestamp:
09/02/10 13:44:18
Author:
cbc
Message:

Parse module xmldoc returns string instead of list.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spongenet/trunk/spongenet/parse.py

    r351 r366  
    140140def xmldoc(path): 
    141141    """ 
    142     Return the XML document as a list of strings from a file at path. 
     142    Return the XML document as a string from a file at path. 
    143143 
    144144    Get the test reference data. 
     
    164164    Verify the test document matches the reference data. 
    165165 
    166     >>> _xmldoc[0] == '<?xml version="1.0" encoding="utf-8"?>\\n
    167     True 
    168     >>> _xmldoc[-1] == '</root>\\n
    169     True 
    170     >>> len(_xmldoc) == xml_doc_lens[os.path.basename(_xmldoc_path)] 
     166    >>> _xmldoc.splitlines()[0] == '<?xml version="1.0" encoding="utf-8"?>
     167    True 
     168    >>> _xmldoc.splitlines()[-1] == '</root>
     169    True 
     170    >>> len(_xmldoc.splitlines()) == xml_doc_lens[os.path.basename(_xmldoc_path)] 
    171171    True 
    172172    >>> doc_hash = hashlib.md5() 
    173     >>> doc_hash.update("".join(_xmldoc)
     173    >>> doc_hash.update(_xmldoc
    174174    >>> doc_hash.hexdigest() == xml_doc_md5s[os.path.basename(_xmldoc_path)] 
    175175    True 
     
    180180        _xmldoc = handle.readlines() 
    181181 
    182     return _xmldoc 
     182    return "".join(_xmldoc) 
    183183 
    184184