Ignore:
Timestamp:
22/08/06 12:46:52 (13 years ago)
Author:
domlowe
Message:

Fix for XML unicode problems (I think). Tests files to see what format they are then passes the correct encoding information to elementtree. Requres further testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/parser/API/ops_Dataset.py

    r1170 r1438  
    11''' ops_Dataset  contains operations for root Dataset class''' 
    22from API import * 
     3import codecs 
    34 
    45def testmethod(self): 
     
    78 
    89def parse(self,csmlfile): 
    9         """must be provided with csmlfile 
    10         parses the csmlfile into self """ 
    11         tree = ElementTree(file=csmlfile) 
    12         self.fromXML(tree.getroot()) 
    13         self =parser_extra.ParserPostProcessor(self).resolveReferences() 
    14  
     10    """must be provided with csmlfile   parses the csmlfile into self """ 
     11    #determine encoding 
     12    f = open(csmlfile) 
     13    startoffile=f.readline() 
     14    encoding=xmlEncoding.autoDetectXMLEncoding(startoffile) 
     15    f.close() 
     16    #parse with correct encoding 
     17    tree = parser_extra.encodingParser(csmlfile,encoding) 
     18    self.fromXML(tree.getroot()) 
     19    self =parser_extra.ParserPostProcessor(self).resolveReferences() 
     20     
    1521def getSecurity(self): 
    1622    """ returns a dictonary containing attributeAuthority: role""" 
     
    1925        if hasattr(self.accessControlPolicy,'dgSecurityConditions'): 
    2026            for condition in self.accessControlPolicy.dgSecurityConditions: 
    21                 print dir(condition) 
    2227                #need to test for these but ok for alpha. 
    2328                cond=[] 
Note: See TracChangeset for help on using the changeset viewer.