def __init__(self, path): self.path = path p = WorkspaceParser() with open(self.path, 'r') as f: p.parse(f.read()) self.filerefs = p.workspace.filerefs self.projects = filter(lambda fileref: fileref.endswith('.xcodeproj'), p.workspace.filerefs)
from workspaceparser import Parser as WorkspaceParser p = WorkspaceParser() with open('test/AFNetworking.xml', 'r') as f: p.parse(f.read()) print p.workspace.version # should print '1.0' print filter(lambda fileref: fileref.path.endswith('.xcodeproj'), p.workspace.filerefs) # should print all xcodeprojects for group in p.workspace.groups: print group