473,473 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Write entities in a XML file

Hi to all!
This is the file that I would like to write using VB.Net and XMLTextWriter:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!--DTD-->

<!DOCTYPE my_file [

<!ELEMENT my_file (text)>

<!ELEMENT text (#PCDATA)>

<!--Entity declarations-->

<!ENTITY agrave "à">

<!ENTITY egrave "è">

<!ENTITY eacute "é">

<!ENTITY igrave "ì">

<!ENTITY ograve "ò">

<!ENTITY ugrave "ù">

]>

<!--End DTD-->

<my_file>

<text>first entity: &agrave; second entity: &igrave; and so
on.......</text>

</my_file>
Instead this is the file that I obtain:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!--DTD-->

<!DOCTYPE my_file [

<!ELEMENT my_file (text)>

<!ELEMENT text (#PCDATA)>

<!--Entity declarations-->

<!ENTITY agrave "à">

<!ENTITY egrave "è">

<!ENTITY eacute "é">

<!ENTITY igrave "ì">

<!ENTITY ograve "ò">

<!ENTITY ugrave "ù">

]>

<!--End DTD-->

<my_file>

<text>first entity: à second entity: ì and so on.......</text>

</my_file>

The code I'm using is:

XWriter.WriteStartElement("my_file")

XWriter.WriteStartElement("text")

XWriter.WriteString("first entity: à second entity: ì and so on......")

XWriter.WriteEndElement()
I tried to use also WriteRaw and WriteElementString.
Are there some options that enabled me to write text containig entities in
the xml file and to obtain the corresponding entity without knowing the DTD?

Thank you in advance to all.
Fede.





Nov 12 '05 #1
2 2008
Hi Fede,

Have you tried using "WriteEntityRef"..

Regards,

Bennie Haelen

"Fede" <fe*********@libero.it> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi to all!
This is the file that I would like to write using VB.Net and XMLTextWriter:
<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!--DTD-->

<!DOCTYPE my_file [

<!ELEMENT my_file (text)>

<!ELEMENT text (#PCDATA)>

<!--Entity declarations-->

<!ENTITY agrave "à">

<!ENTITY egrave "è">

<!ENTITY eacute "é">

<!ENTITY igrave "ì">

<!ENTITY ograve "ò">

<!ENTITY ugrave "ù">

]>

<!--End DTD-->

<my_file>

<text>first entity: &agrave; second entity: &igrave; and so
on.......</text>

</my_file>
Instead this is the file that I obtain:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<!--DTD-->

<!DOCTYPE my_file [

<!ELEMENT my_file (text)>

<!ELEMENT text (#PCDATA)>

<!--Entity declarations-->

<!ENTITY agrave "à">

<!ENTITY egrave "è">

<!ENTITY eacute "é">

<!ENTITY igrave "ì">

<!ENTITY ograve "ò">

<!ENTITY ugrave "ù">

]>

<!--End DTD-->

<my_file>

<text>first entity: à second entity: ì and so on.......</text>

</my_file>

The code I'm using is:

XWriter.WriteStartElement("my_file")

XWriter.WriteStartElement("text")

XWriter.WriteString("first entity: à second entity: ì and so on......")

XWriter.WriteEndElement()
I tried to use also WriteRaw and WriteElementString.
Are there some options that enabled me to write text containig entities in
the xml file and to obtain the corresponding entity without knowing the DTD?
Thank you in advance to all.
Fede.




Nov 12 '05 #2
> Have you tried using "WriteEntityRef"..


Yes, I tried. But if I use it I have to know that Ò correspond to Ograve
entity. So I have to write: XMLWriter.ResolveEntity("Ograve")

But, in general, I don't know the entity's name.
How can I retrieve it from the DTD and put it in a XML file?

Fede.

Nov 12 '05 #3

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

Similar topics

4
by: Google Mike | last post by:
I have PHP version 4.2.2 that ships with RH9. I want to have it write to a file like this: function WriteLog($sLogFile, $sMsg) { if (substr($sLogFile,1,1) != '/') { $sLogFile =...
6
by: Tony C | last post by:
Does Python have a function that is analogous to C's write() or fwrite()- that is , I want to write a file (of arbitrary data) that is 100K, or 1MB (or more) bytes long.. Both write() and...
8
by: Patrik Malmström | last post by:
How do I read, write a file binary? I want to open, say, file.exe read it in to the program, then write it out to file2.exe. Like file copy, anyone have a code sample?
1
by: Jim Heimer | last post by:
Hi, I've been using schema.ini to read an ascii file to a dataset. Would it be possible to write to the ascii file the same way I read from it? In my case, the initial ascii file has two...
0
by: chipotle_pickle | last post by:
You're letting a lot of bad links creep onto that page. Do a Google search for "genesis world energy". The second item found is a broken link to the newsroom. (The third item found explains how the...
2
by: ykgoh | last post by:
Hi. I've a problem of being able to create and remove a directory but unable to write a file inside the created directory for some strange reason. I suspect that this problem could be vaguely...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
2
by: Bina | last post by:
hi, I want to read & write a html file which contain the japanese character. Now how i will do it?I can read & write english character . but when i read & write Japanese character from the html...
24
by: Bill | last post by:
Hello, I'm trying to output buffer content to a file. I either get an access violation error, or crazy looking output in the file depending on which method I use to write the file. Can anyone...
6
by: Thanh-Nhan Le | last post by:
Hello, I have an ASP application on IIS server: http://localhost/myApp I use ASP and a my own VB activex DLL to create a pdf file and write this file to a subfolder of the Application folder:...
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
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,...
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
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
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.