Back to index

nordugrid-arc-nox  1.1.0~rc6
Functions
schemaconv.h File Reference
#include <iostream>
#include <arc/XMLNode.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void strprintf (std::ostream &out, const char *fmt, const std::string &arg1="", const std::string &arg2="", const std::string &arg3="", const std::string &arg4="", const std::string &arg5="", const std::string &arg6="", const std::string &arg7="", const std::string &arg8="", const std::string &arg9="", const std::string &arg10="")
void strprintf (std::string &out, const char *fmt, const std::string &arg1="", const std::string &arg2="", const std::string &arg3="", const std::string &arg4="", const std::string &arg5="", const std::string &arg6="", const std::string &arg7="", const std::string &arg8="", const std::string &arg9="", const std::string &arg10="")
void simpletypeprint (Arc::XMLNode stype, const std::string &ns, std::ostream &h_file, std::ostream &cpp_file)
void simpletypeprintnamed (const std::string &cppspace, const std::string &ntype, Arc::XMLNode stype, const std::string &ns, std::ostream &h_file, std::ostream &cpp_file)
void complextypeprint (Arc::XMLNode ctype, const std::string &ns, std::ostream &h_file, std::ostream &cpp_file)
bool schemaconv (Arc::XMLNode wsdl, std::ostream &h_file, std::ostream &cpp_file, const std::string &name)

Function Documentation

void complextypeprint ( Arc::XMLNode  ctype,
const std::string &  ns,
std::ostream &  h_file,
std::ostream &  cpp_file 
)

Definition at line 271 of file complextype.cpp.

                                                                                                    {
  std::string ntype = ctype.Attribute("name");
  complextypeprintnamed("",ntype,ctype,ns,h_file,cpp_file);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool schemaconv ( Arc::XMLNode  wsdl,
std::ostream &  h_file,
std::ostream &  cpp_file,
const std::string &  name 
)

Definition at line 16 of file schemaconv.cpp.

                                                                                            {
  h_file<<"\
#include <arc/XMLNode.h>\n\
\n\
namespace "<<name<<" {\n\
\n\
";
  cpp_file<<"\
#include \""<<name<<".h\"\n\
\n\
namespace "<<name<<" {\n\
\n\
";
  
  Arc::NS ns;
  ns["wsdl"]="http://schemas.xmlsoap.org/wsdl/";
  ns["xsd"]="http://www.w3.org/2001/XMLSchema";
  wsdl.Namespaces(ns);
  XMLNode schema;
  if(wsdl.FullName() == "wsdl:definitions") {
    schema = wsdl["wsdl:types"]["xsd:schema"];
    if(!schema) {
      std::cerr<<"No Schema in WSDL"<<std::endl;
      return false;
    };  
  } else if(wsdl.FullName() == "xsd:schema") {
    schema = wsdl;
  } else {
    std::cerr<<"Neither WSDL nor XSD found"<<std::endl;
  }
  std::string nnamespace = (std::string)(schema.Attribute("targetNamespace"));
  if(nnamespace.empty()) {
    std::cerr<<"No namespace for new elements in Schema"<<std::endl;
    return false;
  };
  // Declaring classes 
  for(int n = 0;;++n) {
    XMLNode type = schema.Child(n);
    if(!type) break;
    std::string ntype = type.Attribute("name");
    if(ntype.empty()) continue;
    strprintf(h_file,"class %s;\n",ntype);
  };
  // Simple types
  for(XMLNode stype = schema["xsd:simpleType"];(bool)stype;++stype) {
    simpletypeprint(stype,nnamespace,h_file,cpp_file);
  };
  // Complex types
  for(XMLNode ctype = schema["xsd:complexType"];(bool)ctype;++ctype) {
    complextypeprint(ctype,nnamespace,h_file,cpp_file);
  };

  h_file<<"\
} // namespace A\n\
";
  cpp_file<<"\
} // namespace A\n\
\n\
";

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void simpletypeprint ( Arc::XMLNode  stype,
const std::string &  ns,
std::ostream &  h_file,
std::ostream &  cpp_file 
)

Definition at line 50 of file simpletype.cpp.

                                                                                                {
  std::string ntype;
  if(stype.Name() == "simpleType") {
    ntype = (std::string)(stype.Attribute("name"));
    h_file<<"//simple type: "<<ntype<<std::endl;
  } else if(stype.Name() == "complexType") {
    XMLNode extension = stype["xsd:simpleContent"]["xsd:extension"];
    if(!extension) return;
    ntype = (std::string)(stype.Attribute("name"));
    h_file<<"//complex type: "<<ntype<<" (simple content)"<<std::endl;
  } else {
    return;
  }
  simpletypeprintnamed("",ntype,stype,ns,h_file,cpp_file);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void simpletypeprintnamed ( const std::string &  cppspace,
const std::string &  ntype,
Arc::XMLNode  stype,
const std::string &  ns,
std::ostream &  h_file,
std::ostream &  cpp_file 
)

Definition at line 45 of file simpletype.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void strprintf ( std::ostream &  out,
const char *  fmt,
const std::string &  arg1 = "",
const std::string &  arg2 = "",
const std::string &  arg3 = "",
const std::string &  arg4 = "",
const std::string &  arg5 = "",
const std::string &  arg6 = "",
const std::string &  arg7 = "",
const std::string &  arg8 = "",
const std::string &  arg9 = "",
const std::string &  arg10 = "" 
)

Definition at line 12 of file common.cpp.

                                                              {
  char buf[65536];
  buf[0]=0;
  snprintf(buf,sizeof(buf)-1,fmt,arg1.c_str(),arg2.c_str(),arg3.c_str(),
                                 arg4.c_str(),arg5.c_str(),arg6.c_str(),
                                 arg7.c_str(),arg8.c_str(),arg9.c_str(),
                                 arg10.c_str());
  buf[sizeof(buf)-1]=0;
  out<<buf;
}

Here is the caller graph for this function:

void strprintf ( std::string &  out,
const char *  fmt,
const std::string &  arg1 = "",
const std::string &  arg2 = "",
const std::string &  arg3 = "",
const std::string &  arg4 = "",
const std::string &  arg5 = "",
const std::string &  arg6 = "",
const std::string &  arg7 = "",
const std::string &  arg8 = "",
const std::string &  arg9 = "",
const std::string &  arg10 = "" 
)

Definition at line 28 of file common.cpp.

                                                              {
  char buf[65536];
  buf[0]=0;
  snprintf(buf,sizeof(buf)-1,fmt,arg1.c_str(),arg2.c_str(),arg3.c_str(),
                                 arg4.c_str(),arg5.c_str(),arg6.c_str(),
                                 arg7.c_str(),arg8.c_str(),arg9.c_str(),
                                 arg10.c_str());
  buf[sizeof(buf)-1]=0;
  out+=buf;
}