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 ):
1717def __iter__ (self ):
1818open_elements = []
19- contentModelFlag = "PCDATA"
2019for token in _base .Filter .__iter__ (self ):
2120type = token ["type" ]
2221if type in ("StartTag" ,"EmptyTag" ):
2322name = token ["name" ]
24- if contentModelFlag != "PCDATA" :
25- raise LintError ("StartTag not in PCDATA content model flag: %(tag)s" % {"tag" :name })
2623if not isinstance (name ,text_type ):
2724raise LintError ("Tag name is not a string: %(tag)r" % {"tag" :name })
2825if not name :
@@ -44,12 +41,6 @@ def __iter__(self):
4441raise LintError ("Empty attribute localname" )
4542if not isinstance (value ,text_type ):
4643raise 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
5445elif type == "EndTag" :
5546name = token ["name" ]
@@ -62,11 +53,9 @@ def __iter__(self):
6253start_name = open_elements .pop ()
6354if start_name != name :
6455raise LintError ("EndTag (%(end)s) does not match StartTag (%(start)s)" % {"end" :name ,"start" :start_name })
65- contentModelFlag = "PCDATA"
6656
6757elif type == "Comment" :
68- if contentModelFlag != "PCDATA" :
69- raise LintError ("Comment not in PCDATA content model flag" )
58+ pass
7059
7160elif type in ("Characters" ,"SpaceCharacters" ):
7261data = token ["data" ]
@@ -81,8 +70,6 @@ def __iter__(self):
8170
8271elif type == "Doctype" :
8372name = token ["name" ]
84- if contentModelFlag != "PCDATA" :
85- raise LintError ("Doctype not in PCDATA content model flag: %(name)s" % {"name" :name })
8673if not isinstance (name ,text_type ):
8774raise LintError ("Tag name is not a string: %(tag)r" % {"tag" :name })
8875# XXX: what to do with token["data"] ?