Skip to content

Commit 4b22754

Browse files
Ms2gergsnedders
authored andcommitted
Improve the 'Coercing non-XML name' warning (html5lib#418)
This can be helpful in finding the code triggering the warning.
1 parent 2d8919a commit 4b22754

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

html5lib/_ihatexml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,15 @@ def toXmlName(self, name):
254254
nameRest = name[1:]
255255
m = nonXmlNameFirstBMPRegexp.match(nameFirst)
256256
if m:
257-
warnings.warn("Coercing non-XML name", DataLossWarning)
257+
warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning)
258258
nameFirstOutput = self.getReplacementCharacter(nameFirst)
259259
else:
260260
nameFirstOutput = nameFirst
261261

262262
nameRestOutput = nameRest
263263
replaceChars = set(nonXmlNameBMPRegexp.findall(nameRest))
264264
for char in replaceChars:
265-
warnings.warn("Coercing non-XML name", DataLossWarning)
265+
warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning)
266266
replacement = self.getReplacementCharacter(char)
267267
nameRestOutput = nameRestOutput.replace(char, replacement)
268268
return nameFirstOutput + nameRestOutput

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy