File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,7 +176,9 @@ def consumeNumberEntity(self, isHex):
176176 def consumeEntity (self ):
177177 char = None
178178 charStack = [self .stream .char ()]
179- if charStack [0 ] == u"#" :
179+ if charStack [0 ] in spaceCharacters or charStack [0 ] in (EOF , "<" , "&" ):
180+ self .stream .queue .extend (charStack )
181+ elif charStack [0 ] == u"#" :
180182 # We might have a number entity here.
181183 charStack .extend ([self .stream .char (), self .stream .char ()])
182184 if EOF in charStack :
@@ -202,9 +204,6 @@ def consumeEntity(self):
202204 self .tokenQueue .append ({"type" : "ParseError" , "data" :
203205 _ ("Numeric entity expected but none found." )})
204206 # Break out if we reach the end of the file
205- elif charStack [0 ] == EOF :
206- self .tokenQueue .append ({"type" : "ParseError" , "data" :
207- _ ("Entity expected. Got end of file instead." )})
208207 else :
209208 # At this point in the process might have named entity. Entities
210209 # are stored in the global variable "entities".
You can’t perform that action at this time.
0 commit comments