473,396 Members | 2,030 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,396 software developers and data experts.

Output XML non-breaking space (#160) from code


I have an XmlDocument object, and need to output the   entity from
my code. I potentially need to output other similar entities such as
£ for the GBP sign.

Here is some example code:

//-----------------
XmlDocument doc = new XmlDocument();
XmlElement testElement = doc.CreateElement("test");
doc.AppendChild(testElement);

XmlNode spaceNode = doc.CreateEntityReference("160");

testElement.AppendChild(spaceNode);
StringWriter sw = new StringWriter();
XmlWriter xw = new XmlTextWriter(sw);
doc.WriteContentTo(xw);
//-----------------

So far I have tried:

// Produces " "
doc.CreateTextNode(" ");

// Produces " 
doc.CreateTextNode(" ");

// Exception: "Cannot create an EntityReference node with a name
// starting with '#'."
doc.CreateEntityReference("#160");

// Exception: "There is an invalid name character in 160"
doc.CreateEntityReference("160");

It's frustratingly hard just to put " " into my XML document...
Have I missed something obvious?

Thanks,
James.

Nov 16 '05 #1
0 1200

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

Similar topics

3
by: Yuan HOng | last post by:
In my program I have to call an external program and parse its output. For that I use the os.popen2 function, and then read the output stream. But the complexity is that the external program...
2
by: Tim Meagher | last post by:
I am using the XslTransform class in C#.net to output XML files that include non-ascii Unicode characters such as the Greek capital letter theta U+0398. I can easily outout the data as serialized...
15
by: jackiechan | last post by:
I would like to test some things in C and make a graphical output when running them , something like in java for example http://www.cs.bell-labs.com/cm/cs/pearls/sortanim.html (without buttons...
11
by: Roger Leigh | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The program listed below demonstrates the use of wcsftime() and std::time_put<wchar_t> which is a C++ wrapper around it. (I know this isn't C; but...
26
by: Betaver | last post by:
I just want to output a long long or int64 variable use printf function.But if I use printf("%ld",x); I can't output an x more than long. I can only output it like this: long long a,b,c;...
0
by: Tim Meagher | last post by:
I am using the XslTransform class in C#.net to output XML files that include non-ascii Unicode characters such as the Greek capital letter theta U+0398. I can easily outout the data as serialized...
2
by: Remi.Arntzen | last post by:
I tried to compile a program to a elf shared library for a Linux platform on a windows machine with the command: gcc -o Prog.so -shared -Wl,--oformat -Wl,elf32-i386 however this results in ld:...
21
by: Umesh | last post by:
/*program to search a* in a text file & write output in a file.* indicated any character*/ #include<stdio.h> #include<stdlib.h> int main(void) { FILE *f,*fp; f=fopen("c:/1.txt","r");...
7
by: nas | last post by:
Consider this example program which i hav taken from some site #include <iostream> using namespace std; class Base1 { public: virtual void f() { } };
13
by: Jim Langston | last post by:
I had asked this in comp.lang.c++ with out any answers that would actually work, so I'm hoping someone here may know a way. I am calling C library functions that want to output to stdout. I need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.