Wednesday, February 3, 2016
In PPC program can deserialize XML, to the commercial machine, they reported an XML document (1, 1) there is an error
The code is simple:
XmlSerializer serializer = new XmlSerializer (typeof (MyObject1));
MemoryStream mem = new MemoryStream (. (Byte []) cAWSDataSet.Tables ["myFile"] Rows [RowSelected] ["file"]);
MyObject1 obj1 = (MyObject1) serializer.Deserialize (mem); // this line wrong, InvalidOperation, XML document (1, 1) there is an error
MyObject1 code is as follows:
public class MyObject1
{
public GraphicAttri [] graphItems; // GraphicAttri a custom class
public int graphNO;
public MyObject1 ()
{
}
}
Later, through the InnerException found at the root level of the data is invalid, the following are the first few lines (because I think the data is invalid since it is at the root level i, those parameters of the problem certainly is the beginning of the) sequence of xml document:
xml document:
& Lt;? Xml version = "1.0" encoding = "utf-8" & gt;?
& Lt; MyObject1 xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns: xsd = "http://www.w3.org/2001/XMLSchema" & gt;
......
Will the root level of the data line 1 position 1 is which?
Also note that: I used to directly reference the PDA in the sequence of the class (MyObject1), then the program on the PC in using a bit.
Reply:
I do not know XMl on PDA's serialized file to the server (PC machine) after what method is used to turn back, and the PDA does not support binary serialization, but on the PDA can xml deserialization, to the PC to die, so-called "root-level data is invalid," that is MyObject1 it considered invalid root argument, how to change it, I'm confused. . . . .
Reply:
Then do an experiment, there will be a PDA generated xml serialization My Documents, and then copying them again from the PDA in the PC, then the file xml deserialized into corresponding object MyObject1, successful, this basic instructions xml document no problem.
Reply:
XML is not reading the wrong approach. One is the Load (), one is LoadXml ()
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment