0

I understand XML doesn't align with any language necessarily, but what would be the best way/ libraries to use when going from c++ to c# and back?

I am building an app with xamarin, I am going to be receiving and sending data through XML to a server that is coded in C++. I am new to how XML is sent, received and parsed, and need some information on the best way to send XML data over TCP, receive it on the other end, parse the information, and then turn it into variables or objects to process in the c++ app server side. How would this best be accomplished?

evan
  • 61
  • 1
  • 11
  • Since you've obviously read a lot of questions on "C# read XML" the only part of this question that may be harder to research is C++ part... For that there is another post that I think covers information you are looking for. If you find that duplicate not enough - feel free to ask to downvote your post as not showing any research and close as being way too broad instead of duplicate. You may also consider [edit] post to make it about one specific aspect that you could not find solution on SO yet. – Alexei Levenkov Mar 30 '18 at 21:34
  • I suggest using a REST api controller on the server side to receive the XML file. .NETCore csn be used to do this fairly quickly and allows you to support both xml and json. That said, you can just use web sockets to do this if you don't want to get into api work. The problem is that your question leaves the entire implementation open to opinion, as there is really no "best" way to do this. – Paul McDowell Mar 30 '18 at 21:41

1 Answers1

0

Sending the XML payload requires specifying the payload type and attaching it to something like a POST request that you send to your server. When the server receives an XML payload you'll need to use something like a serialization library. You can pick whichever library fits your needs in the languages you're using to read/write XML. You can also use XML Schema Definition files to standardize what the expected format of the XML files is. There are also options to generate class files from XSD files. If you use one of the generators you can write an XSD, generate the classes in your different languages, and then use serialization libraries to serialize and deserialize the XML/objects.

Joseph Evans
  • 1,360
  • 9
  • 14