C# Deserialize XML with multiple XML declarations

Cibale

New Member
A third part supplier has given us XML that is not well formed. It has multiple XML declarations:\[code\]<?xml version="1.0" encoding="utf-16"?><!DOCTYPE bob /><?xml version="1.0"?><!DOCTYPE jim><elements>...</elements\[/code\]My de-serializing code:\[code\] var serializer = new XmlSerializer(response.GetType()); reader = new XmlTextReader(stream) {XmlResolver = null}; result = (IResponse) serializer.Deserialize(reader);\[/code\]The problem I am having is the de-serializer complains about the the multiple XML declarations. Is there any way I can strip the declarations off so that the XML successfully de-serializes?Thanks
 
Back
Top