I need to create an XML file dynamically based on user input.
This is what I came up with, and I ran into two problems.
- if there is a collection of the same element (MaxOccurs = 10) (For example, if the user entered 4 accounts, then how should my code be)
- If there is a selection option. Based on the selected item, child items must be modified.
Someone please help me.
Thank you in advance
BB
My code is:
XElement req = new XElement("order", new XElement("client", new XAttribute("id", clientId), new XElement("quoteback", new XAttribute ("name",quotebackname) ) ), new XElement("accounting", new XElement("account"), new XElement("special_billing_id") ), new XElement("products", new XElement( **productChoiceType**, ***** HERE THE ELEMENTS WILL CHAGE BASED ON **productChoiceType** ) ) ) );
source share