MCPcopy Index your code
hub / github.com/python/cpython / ElementInfo

Class ElementInfo

Lib/xml/dom/expatbuilder.py:60–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60class ElementInfo(object):
61 __slots__ = '_attr_info', '_model', 'tagName'
62
63 def __init__(self, tagName, model=None):
64 self.tagName = tagName
65 self._attr_info = []
66 self._model = model
67
68 def __getstate__(self):
69 return self._attr_info, self._model, self.tagName
70
71 def __setstate__(self, state):
72 self._attr_info, self._model, self.tagName = state
73
74 def getAttributeType(self, aname):
75 for info in self._attr_info:
76 if info[1] == aname:
77 t = info[-2]
78 if t[0] == "(":
79 return _typeinfo_map["ENUM"]
80 else:
81 return _typeinfo_map[info[-2]]
82 return minidom._no_type
83
84 def getAttributeTypeNS(self, namespaceURI, localName):
85 return minidom._no_type
86
87 def isElementContent(self):
88 if self._model:
89 type = self._model[0]
90 return type not in (expat.model.XML_CTYPE_ANY,
91 expat.model.XML_CTYPE_MIXED)
92 else:
93 return False
94
95 def isEmpty(self):
96 if self._model:
97 return self._model[0] == expat.model.XML_CTYPE_EMPTY
98 else:
99 return False
100
101 def isId(self, aname):
102 for info in self._attr_info:
103 if info[1] == aname:
104 return info[-2] == "ID"
105 return False
106
107 def isIdNS(self, euri, ename, auri, aname):
108 # not sure this is meaningful
109 return self.isId((auri, aname))
110
111def _intern(builder, s):
112 return builder._intern_setdefault(s, s)

Callers 2

element_decl_handlerMethod · 0.70
attlist_decl_handlerMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…