Classes generated by XML Data Generator Tool are not contained within the specified namespace - namespaces

I have the same problem as described in this connect issue
http://connect.microsoft.com/VisualStudio/feedback/details/577382/classes-generated-by-xml-data-generator-tool-are-not-contained-within-the-specified-namespace
"An XSD file using the XML Data Generator Tool within a C++/CLI project will create a set of classes that are NOT within a namespace. The classes should be within the namespace specified by the Namespace property of the XML Data Generator Tool. This was detected when upgrading a VS2008 project to VS2010."
I see the /namespace option is on the command line of the XML Data Generator tool but still it does not write the namespace.
In VS 2008
// This source code was auto-generated by xsd, Version=2.0.50727.3038.
//
namespace IOLib {
using namespace System;
ref class CPDS;
In VS 2010
// This source code was auto-generated by xsd, Version=4.0.30319.1.
//
using namespace System;
ref class CPDS;
Is there a way to force xsd tool to write the namespace too.

for xsd.exe the parameter /n: is used to specify the namespace. Don't put a space between the parameter and the value.
Example:
xsd myschema.xsd /c /n:MyNamespace

Visual Studio uses MSBuild to build the targets specified in the solution. They seem to be abandoning C++ in favor of VB and C#. VS 2010 uses settings in
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets`
file. The XSD section is missing an entry namely "Namespace". I set mine to
Namespace ="%(Xsd.Namespace)"
and compliled the xsd and the classes are now in the namespace I specify in the projects property pages.

Related

maven jaxb plugin, java packages generated has mis-match with XSD namespace

Background: I am trying to convert WSDL/XSD to Java classes
Issue: package names generated is mismatching with the namespace. Last part of number namespace is missing, below 02 is missing from package
XSD has - xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"
Java class generated - package iso.std.iso._20022.tech.xsd.pain_001_001;
Steps Taken:
I tried with 2 maven plugin, both gave me same results.
org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
org.codehaus.mojo
jaxb2-maven-plugin
This works as designed. See Section D.5.2 of the JAXB Specification.
Step 2 says:
Remove the trailing file type, one of .?? or .??? or .html.
Apparently, .02 is considered to be the "trailing file type" here and is removed.
Consider using bindings to specify the target package.

How to get the namespace of t4 template

I'm working on a code generation with T4 template. I'm generating multiple .cs files by one template and i need to write correct namespace for this files. Namespace depends on the template location.
How can i get the template namespace for generated .cs files?
I know the only one way to do this - explicit setted property "Custom Tool Namespace" for the template and then get this property via EnvDTE assembly. But this way is not ok for me, cause i need a locate a lot of copies this template for generate files in different propjects and i want to get namespace dynamically by the template location.
Can anyone help me?
Can you use EnvDTE's FileCodeModel to get the relative path of your template; and then use that to build your outputted namespaces?
You might want to browse through this post: http://t4-editor.tangible-engineering.com/blog/walking-the-visual-studio-code-model-with-t4-template.html

Get HTML file produced by JavaDocs

I understand that Javadoc is a documentation generator from Sun Microsystems for generating API documentation in HTML format from Java source code.
I infer that the documentation is stored onto an HTML file.
Is there a way I can access it?
If yes where is it stored?
The word Javadoc can refer to
special comments in Java source files (preceding a declaration, and of the form /** ... */)
a program which converts these comments (as well as the declarations themselves) to readable output
the output itself, usually in HTML form.
The Javadoc program is contained in Sun's (or now Oracle's) Java Development Kit (JDK).
If you have installed a JDK (which you should if you do Java development), you can call it on the command line, passing it the package names to document, or some source file names. You should also indicate the output directory, using the -d option.
I'm assuming the following directory (and package) structure in my example below:
current directory
source
de
dclj
paul
examples
HelloWorld.java [containing package de.dclj.paul.examples; and public class HelloWorld { ... }]
docs
Then you use the following command line:
javadoc -sourcpath source -d docs de.dclj.paul.examples
It will then create a the documentation in the docs directory, with an index.html which you can open in your web browser, and other files reachable from it.
For more details have a look at the documentation linked above. For an example output, have a look at the Java Standard API Javadoc.
If you are using an IDE, you likely have a generate Javadoc button there, and the IDE might even show the formatted output of documentation of single classes or methods on the fly.

struts2 namespace name issue

Hi i am using struts2 and hibernate in my project. I need to use a namespace for my admin section so that i have used the namepace as companyAdmin and i have created a folder inside the web folder named companyAdmin and it is worked fine. But when i delete the folder companyAdmin from the web folder the struts show an error error message when trying to access the namespace. Is there a folder with name as namespace name is a must in struts2 for using the namespace. Also i can't able to use the namespace as "admin" even though i have created a folder in the web folder with a name admin.
Please be clear that Struts2 namespace is nothing related to folder/any other resource in your web-application.
Namespace inside Struts2 subdivides action configurations into logical modules, each with its own identifying prefix.Namespaces avoid conflicts between action names.
This is what doc say about namespace
Namespaces are not a path!
Namespace are not hierarchical like a file system path. There is one namespace level. For example if the URL /barspace/myspace/bar.action is requested, the framework will first look for namespace /barspace/myspace. If the action does not exist at /barspace/myspace, the search will immediately fall back to the default namespace "". The framework will not parse the namespace into a series of "folders". In the Namespace Example, the bar action in the default namespace would be selected.
I suggest you to go through the official documentation of Namespace to get an idea what they are and how they work inside S2
namespace-configuration

T4 template for generating entity code without any config

With the entity framework 4.1, it is now possible to use code first:
http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-model-amp-database-first-walkthrough.aspx
However, this still requires a config file with a model.
Is there T4 template for generating DB access code in C# exclusively, no config file, no edmx file?
In particular, this T4 template should generate the OnModelCreating method.
Does it exist?
Yes such tool exists. It's part of EF Power tools (currently in CTP1) and it is called Reverse Engineer code first. It is not T4 template and it still generates connection string into config file but whole mapping is generated in the code (no edmx).