33from six import text_type
44
55from . import _base
6- from ..constants import cdataElements , rcdataElements , voidElements
6+ from ..constants import voidElements
77
88from ..constants import spaceCharacters
99spaceCharacters = "" .join (spaceCharacters )
@@ -16,13 +16,10 @@ class LintError(Exception):
1616class Filter (_base .Filter ):
1717 def __iter__ (self ):
1818 open_elements = []
19- contentModelFlag = "PCDATA"
2019 for token in _base .Filter .__iter__ (self ):
2120 type = token ["type" ]
2221 if type in ("StartTag" , "EmptyTag" ):
2322 name = token ["name" ]
24- if contentModelFlag != "PCDATA" :
25- raise LintError ("StartTag not in PCDATA content model flag: %(tag)s" % {"tag" : name })
2623 if not isinstance (name , text_type ):
2724 raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
2825 if not name :
@@ -44,12 +41,6 @@ def __iter__(self):
4441 raise LintError ("Empty attribute localname" )
4542 if not isinstance (value , text_type ):
4643 raise LintError ("Attribute value is not a string: %(value)r" % {"value" : value })
47- if name in cdataElements :
48- contentModelFlag = "CDATA"
49- elif name in rcdataElements :
50- contentModelFlag = "RCDATA"
51- elif name == "plaintext" :
52- contentModelFlag = "PLAINTEXT"
5344
5445 elif type == "EndTag" :
5546 name = token ["name" ]
@@ -62,11 +53,9 @@ def __iter__(self):
6253 start_name = open_elements .pop ()
6354 if start_name != name :
6455 raise LintError ("EndTag (%(end)s) does not match StartTag (%(start)s)" % {"end" : name , "start" : start_name })
65- contentModelFlag = "PCDATA"
6656
6757 elif type == "Comment" :
68- if contentModelFlag != "PCDATA" :
69- raise LintError ("Comment not in PCDATA content model flag" )
58+ pass
7059
7160 elif type in ("Characters" , "SpaceCharacters" ):
7261 data = token ["data" ]
@@ -81,8 +70,6 @@ def __iter__(self):
8170
8271 elif type == "Doctype" :
8372 name = token ["name" ]
84- if contentModelFlag != "PCDATA" :
85- raise LintError ("Doctype not in PCDATA content model flag: %(name)s" % {"name" : name })
8673 if not isinstance (name , text_type ):
8774 raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
8875 # XXX: what to do with token["data"] ?
0 commit comments