1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17  """ 
 18  Provides I{marshaller} core classes. 
 19  """ 
 20   
 21  from logging import getLogger 
 22  from suds import * 
 23  from suds.mx import * 
 24  from suds.mx.appender import ContentAppender 
 25  from suds.sax.element import Element 
 26  from suds.sax.document import Document 
 27  from suds.sudsobject import Property 
 28   
 29   
 30  log = getLogger(__name__) 
 31   
 32   
 34      """ 
 35      An I{abstract} marshaller.  This class implement the core 
 36      functionality of the marshaller. 
 37      @ivar appender: A content appender. 
 38      @type appender: L{ContentAppender} 
 39      """ 
 40   
 45   
 64       
 65 -    def append(self, parent, content): 
  66          """ 
 67          Append the specified L{content} to the I{parent}. 
 68          @param parent: The parent node to append to. 
 69          @type parent: L{Element} 
 70          @param content: The content to append. 
 71          @type content: L{Object} 
 72          """ 
 73          log.debug('appending parent:\n%s\ncontent:\n%s', parent, content) 
 74          if self.start(content): 
 75              self.appender.append(parent, content) 
 76              self.end(parent, content) 
  77   
 79          """ 
 80          Reset the marshaller. 
 81          """ 
 82          pass 
  83   
 84 -    def node(self, content): 
  85          """ 
 86          Create and return an XML node. 
 87          @param content: The content for which proccessing has been suspended. 
 88          @type content: L{Object} 
 89          @return: An element. 
 90          @rtype: L{Element} 
 91          """ 
 92          return Element(content.tag) 
  93       
 94 -    def start(self, content): 
  95          """ 
 96          Appending this content has started. 
 97          @param content: The content for which proccessing has started. 
 98          @type content: L{Content} 
 99          @return: True to continue appending 
100          @rtype: boolean 
101          """ 
102          return True 
 103       
105          """ 
106          Appending this content has suspended. 
107          @param content: The content for which proccessing has been suspended. 
108          @type content: L{Content} 
109          """ 
110          pass 
 111       
113          """ 
114          Appending this content has resumed. 
115          @param content: The content for which proccessing has been resumed. 
116          @type content: L{Content} 
117          """ 
118          pass 
 119   
120 -    def end(self, parent, content): 
 121          """ 
122          Appending this content has ended. 
123          @param parent: The parent node ending. 
124          @type parent: L{Element} 
125          @param content: The content for which proccessing has ended. 
126          @type content: L{Content} 
127          """ 
128          pass 
 129       
130 -    def setnil(self, node, content): 
 131          """ 
132          Set the value of the I{node} to nill. 
133          @param node: A I{nil} node. 
134          @type node: L{Element} 
135          @param content: The content to set nil. 
136          @type content: L{Content} 
137          """ 
138          pass 
 139   
141          """ 
142          Set the value of the I{node} to a default value. 
143          @param node: A I{nil} node. 
144          @type node: L{Element} 
145          @param content: The content to set the default value. 
146          @type content: L{Content} 
147          @return: The default. 
148          """ 
149          pass 
 150       
152          """ 
153          Get whether the specified content is optional. 
154          @param content: The content which to check. 
155          @type content: L{Content} 
156          """ 
157          return False 
  158