Esempio n. 1
0
 def xml(self):
     """
     Get xml representation of the object.
     @return: The root node.
     @rtype: L{Element}
     """
     root = Element('Security', ns=wssens)
     root.set('mustUnderstand', str(self.mustUnderstand).lower())
     for t in self.tokens:
         root.append(t.xml())
     return root
Esempio n. 2
0
 def xml(self):
     """
     Get xml representation of the object.
     @return: The root node.
     @rtype: L{Element}
     """
     root = Element('Security', ns=wssens)
     root.set('mustUnderstand', str(self.mustUnderstand).lower())
     for t in self.tokens:
         root.append(t.xml())
     return root
Esempio n. 3
0
 def add(self, root):
     """
     Add an <xs:import/> to the specified schema root.
     @param root: A schema root.
     @type root: L{Element}
     """
     node = Element('import', ns=self.xsdns)
     node.set('namespace', self.ns)
     if self.location is not None:
         node.set('schemaLocation', self.location)
     log.debug('%s inserted', node)
     root.insert(node)
Esempio n. 4
0
 def add(self, root):
     """
     Add an <xs:import/> to the specified schema root.
     @param root: A schema root.
     @type root: L{Element}
     """
     node = Element('import', ns=self.xsdns)
     node.set('namespace', self.ns)
     if self.location is not None:
         node.set('schemaLocation', self.location)
     log.debug('%s inserted', node)
     root.insert(node) 
Esempio n. 5
0
 def apply(self, root):
     """
     Apply the import (rule) to the specified schema.
     If the schema does not already contain an import for the
     I{namespace} specified here, it is added.
     @param root: A schema root.
     @type root: L{Element}
     """
     if not self.filter.match(root, self.ns):
         return
     if self.exists(root):
         return
     node = Element('import', ns=self.xsdns)
     node.set('namespace', self.ns)
     if self.location is not None:
         node.set('schemaLocation', self.location)
     log.debug('inserting: %s', node)
     root.insert(node)
Esempio n. 6
0
 def apply(self, root):
     """
     Apply the import (rule) to the specified schema.
     If the schema does not already contain an import for the
     I{namespace} specified here, it is added.
     @param root: A schema root.
     @type root: L{Element}
     """
     if not self.filter.match(root, self.ns):
         return
     if self.exists(root):
         return
     node = Element('import', ns=self.xsdns)
     node.set('namespace', self.ns)
     if self.location is not None:
         node.set('schemaLocation', self.location)
     log.debug('inserting: %s', node)
     root.insert(node)
Esempio n. 7
0
 def autoblend(self):
     """
     Ensure that all schemas within the collection
     import each other which has a blending effect.
     @return: self
     @rtype: L{SchemaCollection}
     """
     namespaces = self.namespaces.keys()
     for s in self.children:
         for ns in namespaces:
             tns = s.root.get('targetNamespace')
             if  tns == ns:
                 continue
             for imp in s.root.getChildren('import'):
                 if imp.get('namespace') == ns:
                     continue
             imp = Element('import', ns=Namespace.xsdns)
             imp.set('namespace', ns)
             s.root.append(imp)
     return self