string f_xsd_name = string(T_XSD_DIR)+"/"+tservice->get_name()+".xsd";
f_xsd_.open(f_xsd_name.c_str());
+ string ns = program_->get_xsd_namespace();
+ if (ns.size() > 0) {
+ ns = " targetNamespace=\"" + ns + "\" xmlns=\"" + ns + "\"";
+ }
+
// Print the XSD header
f_xsd_ <<
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" << endl <<
- "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" << endl <<
+ "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" << ns << ">" << endl <<
endl <<
"<!-- Yo yo yo, this XSD woz be generated by Thrift. -->" << endl <<
endl;
return java_package_;
}
+ void set_xsd_namespace(std::string xsd_namespace) {
+ xsd_namespace_ = xsd_namespace;
+ }
+
+ const std::string& get_xsd_namespace() const {
+ return xsd_namespace_;
+ }
private:
// Java package
std::string java_package_;
+ // XSD namespace
+ std::string xsd_namespace_;
+
};
#endif
"php_namespace" { return tok_php_namespace; }
"xsd_all" { return tok_xsd_all; }
"xsd_optional" { return tok_xsd_optional; }
+"xsd_namespace" { return tok_xsd_namespace; }
"include" { return tok_include; }
"void" { return tok_void; }
%token tok_java_package
%token tok_xsd_all
%token tok_xsd_optional
+%token tok_xsd_namespace
/**
* Base datatype keywords
g_program->set_java_package($2);
}
}
+| tok_xsd_namespace tok_literal
+ {
+ pdebug("Header -> tok_xsd_namespace tok_literal");
+ if (g_parse_mode == PROGRAM) {
+ g_program->set_xsd_namespace($2);
+ }
+ }
Include:
tok_include tok_literal