chief7
chief7

Reputation: 14393

DataContractSerializer - Ignore XML Declaration

How can I get the DataContractSerializer to ignore the xml declaration in xml I want to deserialize?

I want to avoid reading all bytes from stream and removing the declaration from the string.

Upvotes: 1

Views: 1305

Answers (1)

Oded
Oded

Reputation: 499302

The DataContractSerializer will not serialize the XML declaration, as you do will not have a property for it on the class you are deserializing to.

Regardless - it needs to read the whole file, so the declaration will be read as well.

Why are you trying to remove it like this?

Upvotes: 2

Related Questions