/[papo]/gnue/common/src/GParserHelpers.py
ViewVC logotype

Diff of /gnue/common/src/GParserHelpers.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by charlie, Fri Jun 28 19:43:51 2002 UTC revision 1.1.4.1 by anthonyl, Tue Mar 4 22:09:32 2003 UTC
# Line 16  Line 16 
16  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
17  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
18  #  #
19  # Copyright 2001-2002 Free Software Foundation  # Copyright 2001-2003 Free Software Foundation
20  #  #
21  # FILE:  # FILE:
22  # GParserHelpers.py  # GParserHelpers.py
# Line 32  Line 32 
32  from xml.sax import saxutils  from xml.sax import saxutils
33    
34  #  #
35    # Class ParserObj
36    #
37    # Common initialization for GParser objects
38    #
39    class ParserObj:
40      def __init__(self, parent=None, type='_NotSet_'):
41        self._type = type
42        self._parent = parent       # The object that contains this object
43        self._children = []         # The objects contained by this object
44        self._attributes = {}
45        self._inits = []            # functions called during phaseInit stage
46        self._xmlnamespace = None   # If the object is namespace-qualified, the namespace
47        self._xmlnamespaces = {}    # If attributes are namespace-qualified, a map
48        if parent :
49          parent.addChild(self)
50    
51    
52    #
53  # Class GContent  # Class GContent
54  #  #
55  # Base class for xml content  # Base class for xml content
56  #  #
57  class GContent:  class GContent(ParserObj):
58    
59    def __init__(self, parent, content):    def __init__(self, parent, content):
60        ParserObj.__init__(self, parent, '_content_')
61      self._content = content      self._content = content
     self._type = "_content_"  
     if parent :  
       parent.addChild(self)  
62    
63    def getEscapedContent(self):    def getEscapedContent(self):
64      return saxutils.escape(self._content)      return saxutils.escape(self._content)
# Line 50  class GContent: Line 66  class GContent:
66    def getContent(self):    def getContent(self):
67      return self._content      return self._content
68    
   def toXML(self):  
     return saxutils.escape(self._content)  
   
69    def dumpXML(self, lookupDict, treeDump=None, gap=None,    def dumpXML(self, lookupDict, treeDump=None, gap=None,
70                escape=1, xmlnamespaces={}):                escape=1, xmlnamespaces={}):
71      if escape:      if escape:

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26