Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. How Do I deserialize the following Xml string? [modified]

How Do I deserialize the following Xml string? [modified]

Scheduled Pinned Locked Moved XML / XSL
questionwpfwcfsysadminxml
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashishtango
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • A ashishtango

      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

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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!

      A 1 Reply Last reply
      0
      • S Stuart Dootson

        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!

        A Offline
        A Offline
        ashishtango
        wrote on last edited by
        #3

        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.

        S 1 Reply Last reply
        0
        • A ashishtango

          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.

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #4

          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!

          A 1 Reply Last reply
          0
          • S Stuart Dootson

            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!

            A Offline
            A Offline
            ashishtango
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups