XML clone/possible encoding/byte order mark problem

  • Thread starter Thread starter Donal McWeeney
  • Start date Start date
D

Donal McWeeney

Hi,

I think I may have a slight encoding problem with what I am doing.

I have a test console app that takes an xml document and splits it
into a number of smaller xml documents.

First thing I do is clone the input document. At the moment I am just
saving this document and when I do a windiff on the documents I see some
surouis characters at the beginning of the document I saved.

I guess these are the byte order marks - however if I edit this doc in
VS.Net or notepad these chars are not visible.

Code thus far is very simple:

// load the schema input file
XmlDocument inputXmlDoc = new XmlDocument() ;
inputXmlDoc.PreserveWhitespace = true ;
inputXmlDoc.Load( inputFileFullName ) ;

// clone the input document
XmlDocument outputXmlDoc = (XmlDocument) inputXmlDoc.CloneNode( true ) ;
outputXmlDoc.PreserveWhitespace = true ;

// save the manifest file
outputXmlDoc.Save( manifestFullName ) ;

Could the problem just be with WinDiff?

Thanks

Donal
 
Donal McWeeney said:
I think I may have a slight encoding problem with what I am doing.

I have a test console app that takes an xml document and splits it
into a number of smaller xml documents.

First thing I do is clone the input document. At the moment I am just
saving this document and when I do a windiff on the documents I see some
surouis characters at the beginning of the document I saved.

I guess these are the byte order marks - however if I edit this doc in
VS.Net or notepad these chars are not visible.

Could the problem just be with WinDiff?

The only problem is that you've got two documents which are
semantically the same but which aren't represented in the same way.
Assuming the first two bytes are FF FE or FE FF, you're right - they're
byte order marks, and nothing to worry about.
 
Back
Top