我正在使用Windows CE的C#编写应用程序。我想将从XML(字符串格式)读取的数据转换为XElement格式,然后将其设置为仪表。我已经使用XElemenet.parse()转换了我的数据。但是,当我要设置数据时,出现错误,提示无效数据或XML。
相同的过程在Windows窗体应用程序上可完美运行,但不能在Windows CE上运行。任何想法? Windows CE甚至支持Xelement.parse()吗?
这里是字符串输出
"<Array><Structure><LongUnsigned>8</LongUnsigned><OctetString>0000010000FF</OctetString><Integer>2</Integer><LongUnsigned>0</LongUnsigned></Structure><Structure><LongUnsigned>3</LongUnsigned><OctetString>0100010800FF</OctetString><Integer>2</Integer><LongUnsigned>0</LongUnsigned></Structure></Array>"
并通过Xelement.parse()转换数据;
<Array>
<Structure>
<LongUnsigned>8</LongUnsigned>
<OctetString>0000010000FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010800FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010801FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010802FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010803FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
</Array>
最后是错误
Invalid data or XML:
<Array>
<Structure>
<LongUnsigned>8</LongUnsigned>
<OctetString>0000010000FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010800FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010801FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010802FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
<Structure>
<LongUnsigned>3</LongUnsigned>
<OctetString>0100010803FF</OctetString>
<Integer>2</Integer>
<LongUnsigned>0</LongUnsigned>
</Structure>
</Array>