Make the XSD generator use non-hardcoded namespaces.

- Make the XSD generator use program->get_namespace("xsd")
  instead of program->get_xsd_namespace()
- Eliminate the explicit "xsd_namespace" in t_program.
- Deprecate the xsd_namespace token.
- Update example .thrift files and syntax files.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@745237 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_xsd_generator.cc b/compiler/cpp/src/generate/t_xsd_generator.cc
index 10c1556..bccec2f 100644
--- a/compiler/cpp/src/generate/t_xsd_generator.cc
+++ b/compiler/cpp/src/generate/t_xsd_generator.cc
@@ -243,7 +243,7 @@
   string f_xsd_name = get_out_dir()+tservice->get_name()+".xsd";
   f_xsd_.open(f_xsd_name.c_str());
 
-  string ns = program_->get_xsd_namespace();
+  string ns = program_->get_namespace("xsd");
   if (ns.size() > 0) {
     ns = " targetNamespace=\"" + ns + "\" xmlns=\"" + ns + "\" " +
       "elementFormDefault=\"qualified\"";
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index 4e99294..83ffbea 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -176,14 +176,6 @@
     return php_namespace_;
   }
 
-  void set_xsd_namespace(std::string xsd_namespace) {
-    xsd_namespace_ = xsd_namespace;
-  }
-
-  const std::string& get_xsd_namespace() const {
-    return xsd_namespace_;
-  }
-
  private:
 
   // File path
@@ -225,9 +217,6 @@
   // PHP namespace
   std::string php_namespace_;
 
-  // XSD namespace
-  std::string xsd_namespace_;
-
 };
 
 #endif
diff --git a/compiler/cpp/src/thrifty.yy b/compiler/cpp/src/thrifty.yy
index f27e9ab..24f4eda 100644
--- a/compiler/cpp/src/thrifty.yy
+++ b/compiler/cpp/src/thrifty.yy
@@ -350,11 +350,13 @@
         g_program->set_namespace("cocoa", $2);
       }
     }
+/* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
 | tok_xsd_namespace tok_literal
     {
+      pwarning(1, "'xsd_namespace' is deprecated. Use 'namespace xsd' instead");
       pdebug("Header -> tok_xsd_namespace tok_literal");
       if (g_parse_mode == PROGRAM) {
-        g_program->set_xsd_namespace($2);
+        g_program->set_namespace("cocoa", $2);
       }
     }
 /* TODO(dreiss): Get rid of this once everyone is using the new hotness. */
diff --git a/contrib/thrift.vim b/contrib/thrift.vim
index e350a4e..04d6a10 100644
--- a/contrib/thrift.vim
+++ b/contrib/thrift.vim
@@ -32,7 +32,7 @@
 " Keywords
 syn keyword thriftKeyword namespace
 syn keyword thriftKeyword php_namespace
-syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_namespace xsd_attrs
+syn keyword thriftKeyword xsd_all xsd_optional xsd_nillable xsd_attrs
 syn keyword thriftKeyword include cpp_include cpp_type const optional required
 syn keyword thriftBasicTypes void bool byte i16 i32 i64 double string binary
 syn keyword thriftStructure map list set struct typedef exception enum throws