开发者

XML deserializer (Iserialzable)

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 aga开发者_开发百科in 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


Strangely using only stream didn't work. Using StreamReader and StreamWriter solved it.

Thanks


Usage of dollar sign might cause problems. Try using &#36; instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜