def setAttributes(self, node):
self.attributes = {XMLSchemaComponent.xmlns:{}}<EOL>for k,v in list(node.getAttributeDictionary().items()):<EOL><INDENT>prefix,value = SplitQName(k)<EOL>if value == XMLSchemaComponent.xmlns:<EOL><INDENT>self.attributes[value][prefix or XMLSchemaComponent.xmlns_key] = v<EOL><DEDENT>elif prefix:<EOL><INDENT>ns = node.getNamespace(prefix)<EOL>if not ns: <EOL><INDENT>raise SchemaError('<STR_LIT>'%prefix)<EOL><DEDENT>if ns not in self.attributes:<EOL><INDENT>self.attributes[ns] = {}<EOL><DEDENT>elif value in self.attributes[ns]:<EOL><INDENT>raise SchemaError('<STR_LIT>'%(value, ns))<EOL><DEDENT>self.attributes[ns][value] = v<EOL><DEDENT>elif value not in self.attributes:<EOL><INDENT>self.attributes[value] = v<EOL><DEDENT>else:<EOL><INDENT>raise SchemaError('<STR_LIT>' %value)<EOL><DEDENT><DEDENT>if not isinstance(self, WSDLToolsAdapter):<EOL><INDENT>self.__checkAttributes()<EOL><DEDENT>self.__setAttributeDefaults()<EOL>for k in ['<STR_LIT:type>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>if k in self.attributes:<EOL><INDENT>prefix, value = SplitQName(self.attributes.get(k))<EOL>self.attributes[k] =TypeDescriptionComponent((self.getXMLNS(prefix), value))<EOL><DEDENT><DEDENT>for k in ['<STR_LIT>']:<EOL><INDENT>if k in self.attributes:<EOL><INDENT>qnames = self.attributes[k]<EOL>self.attributes[k] = []<EOL>for qname in qnames.split():<EOL><INDENT>prefix, value = SplitQName(qname)<EOL>self.attributes['<STR_LIT>'].append(TypeDescriptionComponent((self.getXMLNS(prefix), value)))<EOL><DEDENT><DEDENT><DEDENT>
Sets up attribute dictionary, checks for required attributes and 
           sets default attribute values. attr is for default attribute values 
           determined at runtime.

           structure of attributes dictionary
               ['xmlns'][xmlns_key] --  xmlns namespace
               ['xmlns'][prefix] --  declared namespace prefix 
               [namespace][prefix] -- attributes declared in a namespace
               [attribute] -- attributes w/o prefix, default namespaces do
                   not directly apply to attributes, ie Name can't collide 
                   with QName.