sRecieved = "<XmlClient>2.0</XmlClient><XmlVersion>3.0</XmlVersion>"
Dim xml As New XmlDocument();
xml.LoadXml(sRecieved);
There are multiple root elements …..i want xmlclient value and xmlversion value
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well yes, your data isn’t a valid XML document. (The error message is pretty clear – you’ve got multiple top-level elements.) You could make it a valid document by adding a dummy root element:
… but if you get the chance to change whatever’s sending the data, it would be better if it sent an actual XML document.
EDIT: If you’re able to use LINQ to XML instead of
XmlDocument, getting the client number and the version number are easy. For example, as text:EDIT: Okay, if you’re stuck with
XmlDocument, I believe you could use:(and likewise for
xmlVersion)