MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / parse

Method parse

suds/sax/parser.py:115–137  ·  view source on GitHub ↗

SAX parse XML text. @param file: Parse a python I{file-like} object. @type file: I{file-like} object. @param string: Parse string XML. @type string: str

(self, file=None, string=None)

Source from the content-addressed store, hash-verified

113 return (p, h)
114
115 def parse(self, file=None, string=None):
116 """
117 SAX parse XML text.
118 @param file: Parse a python I{file-like} object.
119 @type file: I{file-like} object.
120 @param string: Parse string XML.
121 @type string: str
122 """
123 timer = metrics.Timer()
124 timer.start()
125 sax, handler = self.saxparser()
126 if file is not None:
127 sax.parse(file)
128 timer.stop()
129 metrics.log.debug('sax (%s) duration: %s', file, timer)
130 return handler.nodes[0]
131 if string is not None:
132 if isinstance(string, str):
133 string = string.encode()
134 parseString(string, handler)
135 timer.stop()
136 metrics.log.debug('%s\nsax duration: %s', string, timer)
137 return handler.nodes[0]

Callers 5

downloadMethod · 0.95
invokeMethod · 0.95
getMethod · 0.95
get_replyMethod · 0.95
get_faultMethod · 0.95

Calls 4

startMethod · 0.95
saxparserMethod · 0.95
stopMethod · 0.95
encodeMethod · 0.45

Tested by

no test coverage detected