1

I'm creating a Xamarin app to CRUD stories within VersionOne via their REST interface.

When creating a new story I need to send a POST with an XML Payload with the following formatting:

<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Attribute name="Estimate" act="set">2</Attribute>
<Relation name="Scope" act="set">
    <Asset idref="Scope:2720" />
</Relation>
</Asset>

Do I need to manually create this XML payload (e.g., in a GetXML() on my Story class) or is it possible to get/configure an XML serializer that can do the job for me?

P.S.: I've created a JSON deserializer using Visual Studio "paste json as class" for receiving data (this could also be XML). Could such a class-structure be used for serialization?

Solution

Well, the duplicate post did not resolve my issue. So I instead created a simple GetHTML() function on my story.cs - was actually quite easy to do :-)

public string GetXML()
    {
        string xml = String.Empty;
        xml += "<Asset>";
        xml += "<Attribute name = \"Name\" act = \"set\" >" + Name + "</Attribute>";
        xml += "<Relation name = \"Scope\" act = \"set\" ><Asset idref = \"" + Scope +"\"/></Relation>";     
        xml += "</Asset>";
        return xml;
    }

0 Answers0