How Do I deserialize the following Xml string? [modified]
-
Hi, I am getting this error There is an error in XML document (1, 2) When i Deserialize following Xml. <EnvironmentConfigurations> <EnvironmentConfiguration> <EnvironmentName>ABC</EnvironmentName> <CMSConfiguration> <Address>net.tcp://localhost:9000/Manager</Address> <Binding>netTcpBinding</Binding> <Contract>Common.Interfaces.Server</Contract> </CMSConfiguration> </EnvironmentConfiguration> <EnvironmentConfiguration> <EnvironmentName>XYZ</EnvironmentName> <CMSConfiguration> <Address>net.tcp://localhost:9000/Manager</Address> <Binding>netTcpBinding</Binding> <Contract>Common.Interfaces.Server</Contract> </CMSConfiguration> </EnvironmentConfiguration> </EnvironmentConfigurations>
modified on Tuesday, February 23, 2010 5:11 AM
-
Hi, I am getting this error There is an error in XML document (1, 2) When i Deserialize following Xml. <EnvironmentConfigurations> <EnvironmentConfiguration> <EnvironmentName>ABC</EnvironmentName> <CMSConfiguration> <Address>net.tcp://localhost:9000/Manager</Address> <Binding>netTcpBinding</Binding> <Contract>Common.Interfaces.Server</Contract> </CMSConfiguration> </EnvironmentConfiguration> <EnvironmentConfiguration> <EnvironmentName>XYZ</EnvironmentName> <CMSConfiguration> <Address>net.tcp://localhost:9000/Manager</Address> <Binding>netTcpBinding</Binding> <Contract>Common.Interfaces.Server</Contract> </CMSConfiguration> </EnvironmentConfiguration> </EnvironmentConfigurations>
modified on Tuesday, February 23, 2010 5:11 AM
Deserialize to what? The way in which it's deserialized depends on the type you think it is. Are you sure this was serialized from .NET? That's not the only way to read and write XML, you know - maybe you should be using an XMLReader and parsing the XML yourself?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
Deserialize to what? The way in which it's deserialized depends on the type you think it is. Are you sure this was serialized from .NET? That's not the only way to read and write XML, you know - maybe you should be using an XMLReader and parsing the XML yourself?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
I have serialized using XmlSerializer. I have removed Xml version and namespace information from the XML. I have changed the root node from <ArrayOfEnvironmentConfigurations> to <EnvironmentConfigurations> I want to desrialize this xml. Thank you.
-
I have serialized using XmlSerializer. I have removed Xml version and namespace information from the XML. I have changed the root node from <ArrayOfEnvironmentConfigurations> to <EnvironmentConfigurations> I want to desrialize this xml. Thank you.
The answer to your problem is very, very clear - don't mess with the XML that the serializer produces - all of the things you changed are in there for a reason!!!!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
-
The answer to your problem is very, very clear - don't mess with the XML that the serializer produces - all of the things you changed are in there for a reason!!!!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!
The problem was with the root node element which i changed. I kept the root name as ArrayOfEnvironmentConfigurations and the problem was solved. Thanks for replying.