Monday, March 4, 2013

XML to XSD to CS Code generator


1) Generate XML with desired tags

<?xml version="1.0"?>
<FLSecurity>
    <MainForm Type="CoreForm" Name="EmployeeDetails.aspx" DisplayName="Employee Details Management">
        <SubForms>
            <SubForm Name="EmployeeDetails.ascx" DisplayName="Employee Details">
                <Controls>
                    <Control Type="DataBound" DisplayName="Business Unit" ID="OrgStructureName" ParentControl="Grid" AssociateControl="lblOrgStructure">                       
                            <UserRoles>
                                <Role ID="1" DisplayName="BC Admin">
                                    <IsVisible>True</IsVisible>
                                    <IsEnabled>True</IsEnabled>
                                </Role>
                            </UserRoles>                       
                    </Control>                   
                </Controls>
            </SubForm>
        </SubForms>
    </MainForm>    
</FLSecurity>
        
2) Generate XSD from XML
xsd file.xml {/classes | /dataset} [/element:element]
             [/language:language] [/namespace:namespace]
3)Create XSD to Code
               http://xsd2code.codeplex.com/