Package support :: Package preprocessing :: Package jcml :: Module jcml2ref
[hide private]
[frames] | no frames]

Source Code for Module support.preprocessing.jcml.jcml2ref

 1  ''' 
 2  Created on 31 Oct 2013 
 3   
 4  @author: Eleftherios Avramidis 
 5  ''' 
 6   
 7  from xml.etree.cElementTree import iterparse 
 8  import sys 
 9  from dataprocessor.input.jcmlreader import JcmlReader 
10   
11  if __name__ == '__main__': 
12      source_file = open(sys.argv[1], "r") 
13      # get an iterable 
14      context = iterparse(source_file, events=("start", "end")) 
15      # turn it into an iterator 
16      context = iter(context) 
17      # get the root element 
18      event, root = context.next() 
19       
20      attributes = [] 
21      target_id = 0 
22      for event, elem in context: 
23          #new sentence: get attributes 
24          if event == "start" and elem.tag == "ref": 
25              print elem.text 
26