示例#1
0
 def __init__(self, ref=None):
     """
     @param ref: The schema reference being queried.
     @type ref: qref
     """
     Object.__init__(self)
     self.id = objid(self)
     self.ref = ref
     self.history = []
     self.resolved = False
     if not isqref(self.ref):
         raise Exception('%s, must be qref' % tostr(self.ref))
示例#2
0
 def __init__(self, ref=None):
     """
     @param ref: The schema reference being queried.
     @type ref: qref
     """
     Object.__init__(self)
     self.id = objid(self)
     self.ref = ref
     self.history = []
     self.resolved = False
     if not isqref(self.ref):
         raise Exception('%s, must be qref' % tostr(self.ref))
示例#3
0
 def __init__(self, schema, root):
     """
     @param schema: The containing schema.
     @type schema: L{schema.Schema}
     @param root: The xml root node.
     @type root: L{Element}
     """
     self.schema = schema
     self.root = root
     self.id = objid(self)
     self.name = root.get('name')
     self.qname = (self.name, schema.tns[1])
     self.min = root.get('minOccurs')
     self.max = root.get('maxOccurs')
     self.type = root.get('type')
     self.ref = root.get('ref')
     self.form_qualified = schema.form_qualified
     self.nillable = False
     self.default = root.get('default')
     self.rawchildren = []
     self.cache = {}
示例#4
0
 def __init__(self, schema, root):
     """
     @param schema: The containing schema.
     @type schema: L{schema.Schema}
     @param root: The xml root node.
     @type root: L{Element}
     """
     self.schema = schema
     self.root = root
     self.id = objid(self)
     self.name = root.get('name')
     self.qname = (self.name, schema.tns[1])
     self.min = root.get('minOccurs')
     self.max = root.get('maxOccurs')
     self.type = root.get('type')
     self.ref = root.get('ref')
     self.form_qualified = schema.form_qualified
     self.nillable = False
     self.default = root.get('default')
     self.rawchildren = []
     self.cache = {}
示例#5
0
文件: wsdl.py 项目: levacorp/LevaCorp
 def __init__(self, url, options):
     """
     @param url: A URL to the WSDL.
     @type url: str
     @param options: An options dictionary.
     @type options: L{options.Options}
     """
     log.debug('reading wsdl at: %s ...', url)
     reader = DocumentReader(options)
     d = reader.open(url)
     root = d.root()
     WObject.__init__(self, root)
     self.id = objid(self)
     self.options = options
     self.url = url
     self.tns = self.mktns(root)
     self.types = []
     self.schema = None
     self.children = []
     self.imports = []
     self.messages = {}
     self.port_types = {}
     self.bindings = {}
     self.services = []
     self.add_children(self.root)
     self.children.sort()
     pmd = self.__metadata__.__print__
     pmd.excludes.append('children')
     pmd.excludes.append('wsdl')
     pmd.wrappers['schema'] = repr
     self.open_imports()
     self.resolve()
     self.build_schema()
     self.set_wrapped()
     for s in self.services:
         self.add_methods(s)
     log.debug("wsdl at '%s' loaded:\n%s", url, self)
示例#6
0
 def __init__(self, root, baseurl, options, container=None):
     """
     @param root: The xml root.
     @type root: L{sax.element.Element}
     @param baseurl: The base url used for importing.
     @type baseurl: (str, unicode)
     @param options: An options dictionary.
     @type options: L{options.Options}
     @param container: An optional container.
     @type container: L{SchemaCollection}
     """
     self.root = root
     self.id = objid(self)
     self.tns = self.mktns()
     self.baseurl = baseurl
     self.container = container
     self.children = []
     self.all = []
     self.types = {}
     self.imports = []
     self.elements = {}
     self.attributes = {}
     self.groups = {}
     self.agrps = {}
     if options.doctor is not None:
         options.doctor.examine(root)
     form = self.root.get('elementFormDefault')
     if form is None:
         self.form_qualified = False
     else:
         self.form_qualified = form == 'qualified'
     if container is None:
         self.build()
         self.open_imports(options)
         log.debug('built:\n%s', self)
         self.dereference()
         log.debug('dereferenced:\n%s', self)
示例#7
0
 def __init__(self, root, baseurl, options, container=None):
     """
     @param root: The xml root.
     @type root: L{sax.element.Element}
     @param baseurl: The base url used for importing.
     @type baseurl: basestring
     @param options: An options dictionary.
     @type options: L{options.Options}
     @param container: An optional container.
     @type container: L{SchemaCollection}
     """
     self.root = root
     self.id = objid(self)
     self.tns = self.mktns()
     self.baseurl = baseurl
     self.container = container
     self.children = []
     self.all = []
     self.types = {}
     self.imports = []
     self.elements = {}
     self.attributes = {}
     self.groups = {}
     self.agrps = {}
     if options.doctor is not None:
         options.doctor.examine(root)
     form = self.root.get('elementFormDefault')
     if form is None:
         self.form_qualified = False
     else:
         self.form_qualified = form == 'qualified'
     if container is None:
         self.build()
         self.open_imports(options)
         log.debug('built:\n%s', self)
         self.dereference()
         log.debug('dereferenced:\n%s', self)