473,699 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateEleme nt("test");
doc.AppendChild (testElement);

XmlNode spaceNode = doc.CreateEntit yReference("160 ");

testElement.App endChild(spaceN ode);
StringWriter sw = new StringWriter();
XmlWriter xw = new XmlTextWriter(s w);
doc.WriteConten tTo(xw);
//-----------------

So far I have tried:

// Produces "  "
doc.CreateTextN ode(" ");

// Produces "&# 160;
doc.CreateTextN ode("  ");

// Exception: "Cannot create an EntityReference node with a name
// starting with '#'."
doc.CreateEntit yReference("#16 0");

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

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

Thanks,
James.

Jul 21 '05 #1
0 1880

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

Similar topics

3
1831
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 gives back its output in a piecemeal manner, with long delays between the outputs. In the main program I want to therefore read the output in a non-blocking manner, to read as many bytes as the child process is spitting out. The question is, how...
2
2015
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 UTF-8 by using the default encoding of UTF-8; however, my customer wants any non-ascii characters output as numerically-entity encoded characters, e.g. Θ (where 920 is the decimal equivalent for hexadecimal 398). If I use the Saxon processor or...
15
2267
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 just circles rectangles and such things) is there any extension (library) or any way to make similar (aplet-like but not web-like) output ?? (not ploting into a file but dynamic -> it changes like in that link when you click RUN)
11
5206
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 the "problem" lies in the C library implementation of wcsftime()). I'm not sure if this is a platform-dependent feature or part of the C standard. I've compiled with GCC 3.4.3 on GNU/Linux, and run in an en_GB UTF-8
26
104371
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; a=c/100000000;
0
1118
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 UTF-8 by using the default encoding of UTF-8; however, my customer wants any non-ascii characters output as numerically-entity encoded characters, e.g. Θ (where 920 is the decimal equivalent for hexadecimal 398). If I use the Saxon processor or...
2
6925
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: cannot perform PE operations on non PE output file When compiling to PE format no errors are generated, which leads me to believe that some post processing operations are being preformed. This error message does not help me figure what PE operations...
21
1808
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"); if(f==NULL) { puts("Error opening file");exit(0);}
7
1372
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
1960
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 to capture this to memory for use internally inside the program without modifying the library calls that actually do the output. This is for the GraphViz libraries and it is the output of dot that I'm actually trying to capture. I have...
0
8686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9173
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
9033
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...
1
8911
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
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
7748
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6533
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
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

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.