Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / November 2003

Tip: Looking for answers? Try searching our database.

XML clone/possible encoding/byte order mark problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Donal McWeeney - 28 Nov 2003 12:20 GMT
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
Jon Skeet [C# MVP] - 28 Nov 2003 12:45 GMT
> I think I may have a slight encoding problem with what I am doing.
>
[quoted text clipped - 7 lines]
> I guess these are the byte order marks - however if I edit this doc in
> VS.Net or notepad these chars are not visible.

<snip>

> 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.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Donal McWeeney - 28 Nov 2003 13:32 GMT
Hi Jon,

Thanks for the very quick reply...

Thanks

   Donal

> > I think I may have a slight encoding problem with what I am doing.
> >
[quoted text clipped - 16 lines]
> Assuming the first two bytes are FF FE or FE FF, you're right - they're
> byte order marks, and nothing to worry about.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.