New Feature Suggestion: Saving code in XML format
Messages   Related Types
This message was discovered on microsoft.public.vsnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Johann Blake
I would like to suggest the following feature that Microsoft should add to
the Visual Studio.NET IDE. It would be nice to save code in XML format
rather than the native programming language. Why would you want to do this.
Specialized tools can be created for accessing all the parts of the code
without having to deal with the symantics of parsing the code. Parsing code
is a big pain. Not only that, Microsoft has already written the parsing
code. It wouldn't be a great deal of work exporting the code to XML. The
following example in C# could be saved in the XML format shown following the
code. The XML format should support any programming language:

namespace MyNamespace
{
public class SomeClass
{
void SomeMethod(int Param1)
{
int A = Param1;
}
}
}

<Namespace name="MyNamespace" scope="public">
<Class name="SomeClass">
<Method name="SomeMethod" returntype="void">
<Parameter name="Param1" datatype="int"></Parameter>
<CodeBody>
int A = Param1;
</CodeBody>
</Method>
</Class>
</Namespace>

While you do lose the formating, that's not too bad. In fact, there is an
advantage to losing the formatting. Using XML transformations, it would be
possible for a tool to apply a company's/user's standard formatting style
when reconstructing the code.

Any comments on this suggestion?

Johann Blake

Reply to this message...
 
    
Reckless
Although your idea is an interesting one, a langauge spec is a langauge
spec - so why fight it? I don't see any 'real' benefit to having my
C/C++/C#/VB source stored in XML format other than that the world has gone
XML mad and want very man and his dog stored in the format!

Best of luck in your quest anyways!

"Johann Blake" <Click here to reveal e-mail address> wrote in message
news:OAR0l4uvCHA.456@TK2MSFTNGP09...
[Original message clipped]

Reply to this message...
 
    
Johann Blake
Fight? Fight what? I'm not out to fight a language specification. You
obviously have no idea what you are talking about. My posting here has to do
with tools accessing parts of code so that things like formatting, adding
exception handling, and so on can be applied. This has nothing to do with
the language specification. Obviously Jay B. Harlow who posted a response
sees the obvious need for that. It just so happens that there are many tools
on the market for Visual Basic and C++ that do exactly what I mentioned.
Your comment seems to defy any rational thinking.

Johann

"Reckless" <Click here to reveal e-mail address> wrote in message
news:b0c17c$6mg$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Jay B. Harlow [MVP - Outlook] (VIP)
Johann,
Go for it!

Have a look at System.CodeDom & System.CodeDom.Compiler namespaces for
helper functions on creating any .NET language. There is a ICodeParser
interface available, however MS has chosen on not implementing the methods
on their concrete CodeDomProvider classes...

Had MS exposed the ICodeParser interfaces, you could easily write the
utility to convert source to XML, & back. Actually you could write the XML
to source now. I have a project where I am consider having the 'source' in
XML, then using the CodeDom to generate VB.NET or C# or any other language
that has a CodeDomProvider available...

NOTE: I would recommend the CodeDom over XML Transformations for going from
XML to source.

Hope this helps
Jay

"Johann Blake" <Click here to reveal e-mail address> wrote in message
news:OAR0l4uvCHA.456@TK2MSFTNGP09...
[Original message clipped]

Reply to this message...
 
 
System.CodeDom.Compiler.CodeDomProvider
System.CodeDom.Compiler.ICodeParser




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com