XML deserializer (Iserialzable)

Posted by user311130 on Stack Overflow See other posts from Stack Overflow or by user311130
Published on 2010-05-14T11:24:36Z Indexed on 2010/05/14 13:14 UTC
Read the original article Hit count: 461

Hey everybody,

I have a class in c# that implements Iserialzable.

I'm using a XMLSerializer that produces a XML from instance of that class.

I get the following XML:

<?xml version="1.0"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SessionConfiguration>
    <RemoteMachineName>HV-BENDA</RemoteMachineName>
  </SessionConfiguration>
  <SessionsCredentialsList>
    <CredentialsItem>
      <User>test0</User>
      <Password>Pa$$word1</Password>
    </CredentialsItem>
    <CredentialsItem>
      <User>test1</User>
      <Password>Pa$$word1</Password>
    </CredentialsItem>
    <CredentialsItem>
      <User>test2</User>
      <Password>Pa$$word1</Password>
    </CredentialsItem>
    <CredentialsItem>
      <User>test3</User>
      <Password>Pa$$word1</Password>
    </CredentialsItem>
    <CredentialsItem>
      <User>test4</User>
      <Password>Pa$$word1</Password>
    </CredentialsItem>
  </SessionsCredentialsList>
  <TIME_OUT />
  <LOCAL_USERS_NUM>5</LOCAL_USERS_NUM>
</Configuration>

At some later point in the code I use a XMLSerializer again to deserial that XML document.

and I get the following error:

{"There is an error in XML document (1, 1)."}

Inner exception:

{"Data at the root level is invalid. Line 1, position 1."}

Do someone knows wat could be the problem?

All the best

© Stack Overflow or respective owner

Related posts about Xml

Related posts about .NET