473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

XML clone/possible encoding/byte order mark problem

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
Nov 12 '05 #1
2 2898
Donal McWeeney <do************@NO-SP-AM.aimware.com> wrote:
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.
<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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 12 '05 #2
Hi Jon,

Thanks for the very quick reply...

Thanks

Donal

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Donal McWeeney <do************@NO-SP-AM.aimware.com> wrote:
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.


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

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

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
Sorry about the last... Anyway, here's the question: I've been working on some C# routines to process strings in and out of various encodings. The hope is that I can just let the user type in...
4
by: Majed | last post by:
Hi , all I'm trying to write unicode to a file for another app (not developed with vs2003) to read it. I used StreamWriter with unicode encoding.but I was surprised that the streamwriter adds FFFE...
7
by: Mark | last post by:
Hi... I've been doing a lot of work both creating and consuming web services, and I notice there seems to be a discontinuity between a number of the different cogs in the wheel centering around...
5
by: Adam Rothberg | last post by:
The following code sample should produce a valid xml file to the console. However, when I try this in C# (Visual Studio 2003, 1.1 Framework), there is an extra questionmark preceding the rest of...
2
by: Donal McWeeney | last post by:
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...
0
by: Chris McDonough | last post by:
ElementTree's XML serialization routine implied by tree._write(file, node, encoding, namespaces looks like this (elided): def _write(self, file, node, encoding, namespaces): # write XML to file...
15
by: John Salerno | last post by:
Forgive my newbieness, but I don't quite understand why Unicode is still something that needs special treatment in Python (and perhaps elsewhere). I'm reading Dive Into Python right now, and it...
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
3
by: Martin Z | last post by:
Hi, I have an application that involves sending a lot of XML data to various places. The problem is that once in a while, I just want the XML document as a string (for example, sending to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.