I have an auto-generated XML file which I have to fill with values from an oracle database or with a randomly-generated sequence.
For example:
<ns1:message>
<ns1:messageId> </ns1:messageId>
<ns1:languageCode> </ns1:languageCode>
</ns1:message>
<messageId> should be filled a randomly sequence.
<ns1:languageCode> should be filled with a value from the database.
How can I accomplish this?
There are 2 tasks here actually.
The best way I see so far is using LinqToXML. You can read here, hot to create XML trees.
GetRandomMessageId(),GetRandomLanguageCode().Use .NET Random class to make this happen.
Just as an example:
You can customize what ever you like.