MCPcopy Index your code
hub / github.com/python/cpython / replaceWholeText

Method replaceWholeText

Lib/xml/dom/minidom.py:1148–1174  ·  view source on GitHub ↗
(self, content)

Source from the content-addressed store, hash-verified

1146 return ''.join(L)
1147
1148 def replaceWholeText(self, content):
1149 # XXX This needs to be seriously changed if minidom ever
1150 # supports EntityReference nodes.
1151 parent = self.parentNode
1152 n = self.previousSibling
1153 while n is not None:
1154 if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1155 next = n.previousSibling
1156 parent.removeChild(n)
1157 n = next
1158 else:
1159 break
1160 n = self.nextSibling
1161 if not content:
1162 parent.removeChild(self)
1163 while n is not None:
1164 if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
1165 next = n.nextSibling
1166 parent.removeChild(n)
1167 n = next
1168 else:
1169 break
1170 if content:
1171 self.data = content
1172 return self
1173 else:
1174 return None
1175
1176 def _get_isWhitespaceInElementContent(self):
1177 if self.data.strip():

Callers 1

testReplaceWholeTextMethod · 0.80

Calls 1

removeChildMethod · 0.45

Tested by 1

testReplaceWholeTextMethod · 0.64