Dreaming About An XML Based Pre-Processor for Dotnet
A good concept I had in my mind is developing a pre-processor for .NET compilers, to convert an XSD data structure definition in a VB or C# source code file to equivalent code. Right now, if I need to specify and use a data structure in XSD,
- First of all, I have to create an XSD schema
- Use xsd tool or xsdobjectgen to map it to a set of classes or the Document Object Model.
- Use the DOM in my project
I suggest, Microsoft may soon think about allowing developers to embed XSD definitions with in the source code, so that we can create objects of the XSD schema definition with out going through the above processes. Some kind of embedded XSD?
This will allow developers to define data structures using XSD, directly in their source files, and create and use instances of the same. I dream about writing something like this in a VB.NET source file in the near future.
<xs:element name="PersonType">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required" />
<xs:attribute name="Address" type="xs:string" />
</xs:complexType>
</xs:element>
private person as PersonType
Sub New()
person= new PersonType()
person.Name="Anoop"
End Sub
End Class
Probably I am a little bit over ambitious, but I hope you got my point. But anyway, I'll consider developing a .NET pre-processor which can parse the code above, when I get some time. Err.. Who Knows? Whether something like this is already available?