Schema query class that searches for Attribute references in the specified schema. Matches on root Attribute by qname first, then searches deep into the document.
| 145 | |
| 146 | |
| 147 | class AttrQuery(Query): |
| 148 | """ |
| 149 | Schema query class that searches for Attribute references in the specified |
| 150 | schema. Matches on root Attribute by qname first, then searches deep into |
| 151 | the document. |
| 152 | """ |
| 153 | |
| 154 | def execute(self, schema): |
| 155 | result = schema.attributes.get(self.ref) |
| 156 | if self.filter(result): |
| 157 | result = self.__deepsearch(schema) |
| 158 | return self.result(result) |
| 159 | |
| 160 | def __deepsearch(self, schema): |
| 161 | from suds.xsd.sxbasic import Attribute |
| 162 | result = None |
| 163 | for e in schema.all: |
| 164 | result = e.find(self.ref, (Attribute,)) |
| 165 | if self.filter(result): |
| 166 | result = None |
| 167 | else: |
| 168 | break |
| 169 | return result |
| 170 | |
| 171 | |
| 172 | class AttrGroupQuery(Query): |