⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schema.cpp

📁 linux下简单对象应用协议的开发库
💻 CPP
📖 第 1 页 / 共 4 页
字号:
}void xs__schema::sourceLocation(const char *loc){ location = soap_strdup(soap, loc);}const char *xs__schema::sourceLocation(){ return location;}int xs__schema::error(){ return soap->error;}void xs__schema::print_fault(){ soap_print_fault(soap, stderr);  soap_print_fault_location(soap, stderr);}void xs__schema::builtinType(const char *type){ builtinTypeSet.insert(type);}void xs__schema::builtinElement(const char *element){ builtinElementSet.insert(element);}void xs__schema::builtinAttribute(const char *attribute){ builtinAttributeSet.insert(attribute);}const SetOfString& xs__schema::builtinTypes() const{ return builtinTypeSet;}const SetOfString& xs__schema::builtinElements() const{ return builtinElementSet;}const SetOfString& xs__schema::builtinAttributes() const{ return builtinAttributeSet;}xs__include::xs__include(){ schemaLocation = NULL;  schemaRef = NULL;}int xs__include::preprocess(xs__schema &schema){ if (vflag)    cerr << "Preprocessing schema include " << (schemaLocation?schemaLocation:"?") << endl;  if (!schemaRef)    if (schemaLocation)      schemaRef = new xs__schema(schema.soap, schema.sourceLocation(), schemaLocation);  return SOAP_OK;}int xs__include::traverse(xs__schema &schema){ return SOAP_OK;}void xs__include::schemaPtr(xs__schema *schema){ schemaRef = schema;}xs__schema *xs__include::schemaPtr() const{ return schemaRef;}xs__redefine::xs__redefine(){ schemaLocation = NULL;  schemaRef = NULL;}int xs__redefine::preprocess(xs__schema &schema){ if (vflag)    cerr << "Preprocessing schema redefine " << (schemaLocation?schemaLocation:"") << endl;  if (!schemaRef)  { if (schemaLocation)    { schemaRef = new xs__schema(schema.soap, schema.sourceLocation(), schemaLocation);      for (vector<xs__group>::iterator gp = schemaRef->group.begin(); gp != schemaRef->group.end(); ++gp)      { if ((*gp).name)        { for (vector<xs__group>::const_iterator g = group.begin(); g != group.end(); ++g)          { if ((*g).name && !strcmp((*gp).name, (*g).name))            { *gp = *g;              break;            }          }        }      }      for (vector<xs__attributeGroup>::iterator ag = schemaRef->attributeGroup.begin(); ag != schemaRef->attributeGroup.end(); ++ag)      { if ((*ag).name)        { for (vector<xs__attributeGroup>::const_iterator g = attributeGroup.begin(); g != attributeGroup.end(); ++g)          { if ((*g).name && !strcmp((*ag).name, (*g).name))            { *ag = *g;              break;            }          }        }      }      for (vector<xs__simpleType>::iterator st = schemaRef->simpleType.begin(); st != schemaRef->simpleType.end(); ++st)      { if ((*st).name)        { for (vector<xs__simpleType>::const_iterator s = simpleType.begin(); s != simpleType.end(); ++s)          { if ((*s).name && !strcmp((*st).name, (*s).name))            { *st = *s;              break;            }          }        }      }      for (vector<xs__complexType>::iterator ct = schemaRef->complexType.begin(); ct != schemaRef->complexType.end(); ++ct)      { if ((*ct).name)        { for (vector<xs__complexType>::const_iterator c = complexType.begin(); c != complexType.end(); ++c)          { if ((*c).name && !strcmp((*ct).name, (*c).name))            { *ct = *c;              break;            }          }        }      }    }  }  return SOAP_OK;}int xs__redefine::traverse(xs__schema &schema){ return SOAP_OK;}void xs__redefine::schemaPtr(xs__schema *schema){ schemaRef = schema;}xs__schema *xs__redefine::schemaPtr() const{ return schemaRef;}xs__import::xs__import(){ namespace_ = NULL;  schemaLocation = NULL;  schemaRef = NULL;}int xs__import::traverse(xs__schema &schema){ if (vflag)    cerr << "Analyzing schema import " << (namespace_?namespace_:"") << endl;  if (!schemaRef)  { bool found = false;    if (namespace_)    { for (SetOfString::const_iterator i = exturis.begin(); i != exturis.end(); ++i)      { if (!soap_tag_cmp(namespace_, *i))        { found = true;          break;        }      }    }    else      fprintf(stderr, "Warning: no namespace in <import>\n");    if (!found && !iflag) // don't import any of the schemas in the .nsmap table (or when -i option is used)    { const char *s = schemaLocation;      if (!s)        s = namespace_;      schemaRef = new xs__schema(schema.soap, schema.sourceLocation(), s);      if (schemaRef)      { if (!schemaRef->targetNamespace || !*schemaRef->targetNamespace)          schemaRef->targetNamespace = namespace_;        else if (!namespace_ || strcmp(schemaRef->targetNamespace, namespace_))          fprintf(stderr, "Warning: schema import '%s' with schema targetNamespace '%s' mismatch\n", namespace_?namespace_:"", schemaRef->targetNamespace);      }    }  }  if (schemaRef)    schemaRef->traverse();  return SOAP_OK;}void xs__import::schemaPtr(xs__schema *schema){ schemaRef = schema;}xs__schema *xs__import::schemaPtr() const{ return schemaRef;}xs__attribute::xs__attribute(){ schemaRef = NULL;  attributeRef = NULL;  simpleTypeRef = NULL;}int xs__attribute::traverse(xs__schema &schema){ if (vflag)    cerr << "Analyzing schema attribute " << (name?name:"") << endl;  schemaRef = &schema;  const char *token = qname_token(ref, schema.targetNamespace);  attributeRef = NULL;  if (token)  { for (vector<xs__attribute>::iterator i = schema.attribute.begin(); i != schema.attribute.end(); ++i)      if (!strcmp((*i).name, token))      { attributeRef = &(*i);        if (vflag)          cerr << "Found attribute " << (name?name:"") << " ref " << (token?token:"") << endl;        break;      }  }  if (!attributeRef)  { for (vector<xs__import>::iterator i = schema.import.begin(); i != schema.import.end(); ++i)    { xs__schema *s = (*i).schemaPtr();      if (s)      { token = qname_token(ref, s->targetNamespace);        if (token)        { for (vector<xs__attribute>::iterator j = s->attribute.begin(); j != s->attribute.end(); ++j)            if (!strcmp((*j).name, token))            { attributeRef = &(*j);              if (vflag)                cerr << "Found attribute " << (name?name:"") << " ref " << (token?token:"") << endl;              break;            }          break;        }      }    }  }  if (simpleType)  { simpleType->traverse(schema);    simpleTypeRef = simpleType;  }  else  { token = qname_token(type, schema.targetNamespace);    simpleTypeRef = NULL;    if (token)    { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)        if (!strcmp((*i).name, token))        { simpleTypeRef = &(*i);          if (vflag)            cerr << "Found attribute " << (name?name:"") << " type " << (token?token:"") << endl;          break;        }    }    if (!simpleTypeRef)    { for (vector<xs__import>::iterator i = schema.import.begin(); i != schema.import.end(); ++i)      { xs__schema *s = (*i).schemaPtr();        if (s)        { token = qname_token(type, s->targetNamespace);          if (token)          { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)              if (!strcmp((*j).name, token))              { simpleTypeRef = &(*j);                if (vflag)                  cerr << "Found attribute " << (name?name:"") << " type " << (token?token:"") << endl;                break;              }            break;          }        }      }    }  }  if (!attributeRef && !simpleTypeRef)  { if (ref)    { if (is_builtin_qname(ref))        schema.builtinAttribute(ref);      else        cerr << "Warning: could not find attribute '" << (name?name:"") << "' ref '" << ref << "' in schema " << (schema.targetNamespace?schema.targetNamespace:"") << endl;    }    else if (type)    { if (is_builtin_qname(type))        schema.builtinType(type);      else        cerr << "Warning: could not find attribute '" << (name?name:"") << "' type '" << type << "' in schema " << (schema.targetNamespace?schema.targetNamespace:"") << endl;    }  }  return SOAP_OK;}void xs__attribute::schemaPtr(xs__schema *schema){ schemaRef = schema;}xs__schema* xs__attribute::schemaPtr() const{ return schemaRef;}void xs__attribute::attributePtr(xs__attribute *attribute){ attributeRef = attribute;}void xs__attribute::simpleTypePtr(xs__simpleType *simpleType){ simpleTypeRef = simpleType;}xs__attribute *xs__attribute::attributePtr() const{ return attributeRef;}xs__simpleType *xs__attribute::simpleTypePtr() const{ return simpleTypeRef;}xs__element::xs__element(){ schemaRef = NULL;  elementRef = NULL;  simpleTypeRef = NULL;  complexTypeRef = NULL;}int xs__element::traverse(xs__schema &schema){ if (vflag)    cerr << "Analyzing schema element " << (name?name:"") << endl;  schemaRef = &schema;  const char *token = qname_token(ref, schema.targetNamespace);  elementRef = NULL;  if (token)  { for (vector<xs__element>::iterator i = schema.element.begin(); i != schema.element.end(); ++i)      if (!strcmp((*i).name, token))      { elementRef = &(*i);        if (vflag)          cerr << "Found element " << (name?name:"") << " ref " << (token?token:"") << endl;        break;      }  }  if (!elementRef)  { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)    { xs__schema *s = (*i).schemaPtr();      if (s)      { token = qname_token(ref, s->targetNamespace);        if (token)        { for (vector<xs__element>::iterator j = s->element.begin(); j != s->element.end(); ++j)          { if (!strcmp((*j).name, token))            { elementRef = &(*j);              if (vflag)                cerr << "Found element " << (name?name:"") << " ref " << (token?token:"") << endl;              break;            }          }          break;        }      }    }  }  if (simpleType)  { simpleType->traverse(schema);    simpleTypeRef = simpleType;  }  else  { token = qname_token(type, schema.targetNamespace);    simpleTypeRef = NULL;    if (token)    { for (vector<xs__simpleType>::iterator i = schema.simpleType.begin(); i != schema.simpleType.end(); ++i)        if (!strcmp((*i).name, token))        { simpleTypeRef = &(*i);          if (vflag)            cerr << "Found element " << (name?name:"") << " simpleType " << (token?token:"") << endl;          break;        }    }    if (!simpleTypeRef)    { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)      { xs__schema *s = (*i).schemaPtr();        if (s)        { token = qname_token(type, s->targetNamespace);          if (token)          { for (vector<xs__simpleType>::iterator j = s->simpleType.begin(); j != s->simpleType.end(); ++j)            { if (!strcmp((*j).name, token))              { simpleTypeRef = &(*j);                if (vflag)                  cerr << "Found element " << (name?name:"") << " simpleType " << (token?token:"") << endl;                break;              }            }            break;          }        }      }    }  }  if (complexType)  { complexType->traverse(schema);    complexTypeRef = complexType;  }  else  { token = qname_token(type, schema.targetNamespace);    complexTypeRef = NULL;    if (token)    { for (vector<xs__complexType>::iterator i = schema.complexType.begin(); i != schema.complexType.end(); ++i)        if (!strcmp((*i).name, token))        { complexTypeRef = &(*i);          if (vflag)            cerr << "Found element " << (name?name:"") << " complexType " << (token?token:"") << endl;          break;        }    }    if (!complexTypeRef)    { for (vector<xs__import>::const_iterator i = schema.import.begin(); i != schema.import.end(); ++i)      { xs__schema *s = (*i).schemaPtr();        if (s)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -