XML Deserialize error
Error
Code
xml
System.InvalidOperationException: There is an error in XML document (4, 2).
---> System.InvalidOperationException: <database xmlns='http://www.iw.com/sns/platform/'> was not expected.System.InvalidOperationException: There is an error in XML document (4, 2).
---> System.InvalidOperationException: <database xmlns='http://www.iw.com/sns/platform/'> was not expected.Code
var serializer = new XmlSerializer(typeof(XmlUtils));
var reader = XmlReader.Create("test.xml", new XmlReaderSettings
{
IgnoreComments = true,
IgnoreWhitespace = true,
LineNumberOffset = 2,
IgnoreProcessingInstructions = true,
});
serializer.Deserialize(reader);var serializer = new XmlSerializer(typeof(XmlUtils));
var reader = XmlReader.Create("test.xml", new XmlReaderSettings
{
IgnoreComments = true,
IgnoreWhitespace = true,
LineNumberOffset = 2,
IgnoreProcessingInstructions = true,
});
serializer.Deserialize(reader);xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<tns:database xmlns:tns="http://www.iw.com/sns/platform/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group id="function_on">
<ItemSpec id="test" open="true">
</Group>
</tns:database><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<tns:database xmlns:tns="http://www.iw.com/sns/platform/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Group id="function_on">
<ItemSpec id="test" open="true">
</Group>
</tns:database>