From 0b3e5434513c2e0be465bcfec83c5b98be73349f Mon Sep 17 00:00:00 2001 From: Ryan Rix Date: Sat, 5 Dec 2009 20:46:27 -0700 Subject: I'm not sure wtf is wrong but the object is kinda broken right now. I think my algorithm for generating the tree of objects is broken :( WIll look into it tomorrow, suffering massive caffeine headache. --- backend/tour_menuobject.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'backend') diff --git a/backend/tour_menuobject.py b/backend/tour_menuobject.py index c97c9ec..a16b84a 100644 --- a/backend/tour_menuobject.py +++ b/backend/tour_menuobject.py @@ -21,6 +21,7 @@ import io import os.path import xml.parsers.expat import sys +import pprint """ @@ -57,7 +58,7 @@ node.nodeType = Page """ class MenuObject: isValid = True - currenElement = False + currenElement = "powo" rootNode = False activeNode = False @@ -87,6 +88,7 @@ class MenuObject: "fedora-logo-sprite", and "" respectively as arguments and these are used to create the object. """ + print "Initializing and starting XML Parser for "+package+"." self.parser = xml.parsers.expat.ParserCreate() self.parser.CharacterDataHandler = self.parserCharData self.parser.StartElementHandler = self.parserStartElement @@ -150,10 +152,18 @@ class MenuObject: TODO: Finish handlers for other entities, you missed a few. """ def parserCharData(self, data): - if self.currenElement == False: - pass - elif self.currentElement == "DisplayName": + if data == "": + return + + #if self.currenElement == False: + # return + + print "currentElement: "+self.currentElement + print "data: "+data + + + if self.currentElement == "DisplayName": self.activeNode.displayName = data elif self.currentElement == "Icon": @@ -187,4 +197,8 @@ class MenuObject: def makeIcon(self, iconID): pass -print MenuObject("../data/package.xml").isValid \ No newline at end of file +menu = MenuObject("../data/package.xml") +print "===========================" +print menu.IconID +print menu.Priority +print menu.DocRoot \ No newline at end of file -- cgit