Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. {'a':{'b':'c',
  2. 'd':'e',
  3. 'f':'g',
  4. 'h':{'i':'j',
  5. 'k':'l',
  6. 'm':'n'
  7. }
  8. }
  9. 'o':'p'
  10. }
  11.  
  12. {'a':{'b':{'c':{'d':'e',
  13. 'f':'g'
  14. }
  15. }
  16. }
  17. }
  18.  
  19. class XMLStructure(Model.models):
  20. node_name = models.CharField()
  21. parent = models.ForeignKey('XMLStructure')
  22.  
  23. @staticmethod
  24. def get_root(self):
  25. # return the root of the structure
  26.  
  27. def has_children(self):
  28. # return true / false if it's a leaf
  29.  
  30. @staticmethod
  31. def get_leaves(self):
  32. # return all leaves of my xml
  33.  
  34. dict_as_list = ['a','/','b','d','f','h','/','i','k','m','','','o','']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement