0
Answer

Help - deserializing XML

Ask a question
mgerke

mgerke

19y
3.3k
1
"There is an error in the XML document" I receive this message, though my XML is well formed. Here's my XML as it looks in code (the batchInfoNode cited in code snippet below): Here's my code: // Create an instance of the XmlSerializer specifying type. XmlSerializer serializer = null; serializer = new XmlSerializer(typeof(BatchInfoData)); XmlNode batchInfoNode = batchNode.SelectSingleNode("/BATCH/BATCHINFO"); XmlNodeReader reader = new XmlNodeReader(batchInfoNode); // Use the Deserialize method to restore the object's state. m_batchInfoData = (BatchInfoData)serializer.Deserialize(reader); And the BatchInfoData object class is tagged as [Serializable()] And the properties are decorated with tags such as [DataName("process_name"), DataType(), XmlAttribute("processname")] Where am I going wrong? Thanks.