-1

I have an xml how can i structure the class so that when i serialize it, it looks like this.

<Security xmlns="http://docs.oasis-open.org/x/xxxxx.xsd"  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
    <saml:Assertion ID="xxxxx" IssueInstant="xxxxxxx" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
        <saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified">MyApp</saml:Issuer>
        <saml:Subject>
            <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:unspecified">MyApp</saml:NameID>
        </saml:Subject>
        <saml:AttributeStatement>
            <saml:Attribute Name="UserID" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
                <saml:AttributeValue>TestUserID</saml:AttributeValue>
            </saml:Attribute>
            <saml:Attribute Name="UserFirstName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
                <saml:AttributeValue>TestUserFirstName</saml:AttributeValue>
            </saml:Attribute>
            <saml:Attribute Name="UserLastName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
                <saml:AttributeValue>TestUserLastName</saml:AttributeValue>
            </saml:Attribute>
            <saml:Attribute Name="ReasonForSearch" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
                <saml:AttributeValue>ReasonForSearch</saml:AttributeValue>
            </saml:Attribute>
        </saml:AttributeStatement>
    </saml:Assertion>
</Security>
DotNetBeginner
  • 412
  • 2
  • 15
  • 34

1 Answers1

3

Use the xsd.exe to first generate an XSD and then use the same exe to generate class files. More info - http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx.

Saved your xml as security.xml on my system and ran the following commands in visual studio command prompt:

xsd Security.xml

The step above generated two xsd files which can be used to generate class.

xsd Security.xsd Security_app1.xsd /classes
Tim
  • 46
  • 1
  • i tried using this Start -> All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt as i dont have xsd.exe but i need to ask my admin ppl to give me access as error message i am getting is dennied access – DotNetBeginner Sep 05 '13 at 23:05