473,802 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving XmlDocument with Danish Encoding????

Hi,

I'm trying to update a vbproj xml file programatically , but when I try to
open the updated vbproj file in Vs.Net, all entries ("Files") with danish
chars are wrong.

How do I force the XmlDocument.Sav e to encode to Danish chars
('ISO-8859-1')?

Thanks in advance.

M O J O
Nov 12 '05 #1
1 3997
Hi MOJO,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to save the xml document to a
file which is encoded with ISO-8859-1 format. If there is any
misunderstandin g, please feel free to let me know.

We can see that XmlDocument.Sav e has an overload public virtual void
Save(TextWriter );. We can create a StreamWriter and set the encoding of
that StreamWriter to achieve this. Here is an example:

xmlDocument.Sav e(new StreamWriter(fi lename, false,
System.Text.Enc oding.GetEncodi ng("ISO-8859-1")));

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2

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

Similar topics

18
17543
by: LarsM | last post by:
Hi all, I am new to XML, but I use it for an RSS feed. I have one problem, which I have really been struggling with. My XML document is generated from the contents of a MySQL database. It is UTF-8 encoded. However, the Danish special characters appear wrong.
15
4383
by: Nicolai Pedersen | last post by:
I have a problem validating a simple piece of XHTML containing danish characters. Trying to validate the following piece of XHTML gives the error mentioned beneath. If I remove the first line (the XML part) the document validates fine. Does anyone have an idea how to solve this problem without changing the characters to #xxx; or &oslash; I've triede with UTF-8. ************************************************** <?xml version="1.0"...
1
6825
by: Shawn | last post by:
Hi. I'm using a FileStream (instead of just the path to the xml file) to load an XmlDocument. I'm doing this because I need to be able to prevent other processes to update the file I'm working on. The problem is that I'm getting multiple processing instructions and multiple root elements in my xml file when I use a FileStream. Here is an example: test_1.xml contains: <?xml version="1.0" encoding="utf-8"?> <root>
2
18060
by: Eric Cadwell | last post by:
We are encoding strings using XMLElement: private string XMLEncode(string val) { if(val.Length == 0) return string.Empty; XmlElement element = xmldoc.CreateElement("E"); element.InnerText = val; return element.InnerXml;
7
4185
by: Mark | last post by:
Hi... A colleague just referred this question to me. He's getting an xml file from another party, which he's trying to process into another dom using an XmlTextReader and XmlDocument.ReadNode(). The problem is that it's breaking and he doesn't understand why. I didn't exactly either, which is why I'm posting a question here. First, his program just creates a new dom using new document like this: XmlDocument xml = new XmlDocument();
3
1870
by: Mungo Jerrie | last post by:
Hi there :-) I have some problems with the same instance of my xmldocument across 3 different classes. See code below: class one { protected static XmlDocument doc = new XmlDocument(); public static XmlDocument getXmlDocument(){
0
1141
by: Francisco J. Martinez | last post by:
Hi. Im writing a web service that returns an XML Document that it retrieves from a file in disk or a stream. But the web service always returns the XML document with this header: <?xml version="1.0" encoding="utf-8" ?> This happens even when the file in disk already has a header specifying a different encoding. Here's a part of the web service code:
1
1804
by: Patrick.O.Ige | last post by:
I have this small snippet below and i want to save some data back to the xml file. So i looked for a node and checked if the node value is the same as a textbox value and if yes i pass in the new value entered from a textbox back t the xml datasource. I'm populating values of the textboxes from an xml dtrasource But it doesn't see to work am i missing something Thanks in advance
3
1341
by: Jens Jensen | last post by:
Hello, I have a web site and i use some danish text on some of the page. The letters appear as expected when i view the site with the VS 2005 built in web server. When i deploy the site either by XCOPY or as precompiled on win 2k3 IIS 6, then i loose my danish chars. can someone tell me how i can best deal with this problem. many thanks in advance
0
10538
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10063
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.