File tree 1 file changed +3
-2
lines changed
src/html5lib/treebuilders
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -281,8 +281,9 @@ def insertDoctype(self, token):
281
281
publicId = token ["publicId" ]
282
282
systemId = token ["systemId" ]
283
283
284
- if not name or ihatexml .nonXmlBMPRegexp .search (name ):
284
+ if not name or ihatexml .nonXmlBMPRegexp .search (name ) or name [ 0 ] == '"' :
285
285
warnings .warn ("lxml cannot represent null or non-xml doctype" , DataLossWarning )
286
+
286
287
doctype = self .doctypeClass (name , publicId , systemId )
287
288
self .doctype = doctype
288
289
@@ -296,7 +297,7 @@ def insertRoot(self, token):
296
297
#Therefore we need to use the built-in parser to create our iniial
297
298
#tree, after which we can add elements like normal
298
299
docStr = ""
299
- if self .doctype and self .doctype .name :
300
+ if self .doctype and self .doctype .name and not self . doctype . name . startswith ( '"' ) :
300
301
docStr += "<!DOCTYPE %s" % self .doctype .name
301
302
if (self .doctype .publicId is not None or
302
303
self .doctype .systemId is not None ):
You can’t perform that action at this time.
0 commit comments