Encode xml text

Hello,
I have a code that generates a xml file and I have some texts that contains 
" ' < > etc....

how do I encode these texts to have them showed with the characters < " ' / 
 > etc...

thanks!
Bruno 


0
no3012 (142)
2/3/2005 6:31:46 AM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
606 Views

Similar Articles

[PageSpeed] 26

Bruno wrote:

> I have a code that generates a xml file and I have some texts that contains 
> " ' < > etc....
> 
> how do I encode these texts to have them showed with the characters < " ' / 
>  > etc...

Why doesn't you code use standard XML API for creating XML? Just use 
XmlTextWriter to create XML and don't bother about XML syntax 
peculiarities - XmlTextWriter takes care.

-- 
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
0
Oleg
2/3/2005 10:27:54 AM
but I'm using xmlDocument and xmlNode to create the nodes, I would need to 
change all my code and use xmlTextWriter?

Bruno

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message 
news:uzw9VsdCFHA.3740@TK2MSFTNGP09.phx.gbl...
> Bruno wrote:
>
>> I have a code that generates a xml file and I have some texts that 
>> contains " ' < > etc....
>>
>> how do I encode these texts to have them showed with the characters < " ' 
>> / > etc...
>
> Why doesn't you code use standard XML API for creating XML? Just use 
> XmlTextWriter to create XML and don't bother about XML syntax 
> peculiarities - XmlTextWriter takes care.
>
> -- 
> Oleg Tkachenko [XML MVP, MCP]
> http://blog.tkachenko.com 


0
no3012 (142)
2/3/2005 3:03:08 PM
I am sure Oleg meant that you should use an approach that automaically 
handles issues
like the special character encoding.
If you use the XmlDocument (XML DOM) you have just about no trouble with 
that,
because the DOM does it for you.
Similary, if you read an XML document using XML DOM, the DOM will 
appropriately decode the data you read.
If you on the other hand would use a pure text writer, like StreamWriter for 
instance,
then you would have to take care of the character encoding issues yourself.

Sorry, I cannot understand your problem without more information.


-- 
Regards,
Dennis JD Myr´┐Żn
Oslo Kodebureau
"Bruno" <no@no.com> wrote in message 
news:OR546FgCFHA.2032@tk2msftngp13.phx.gbl...
> but I'm using xmlDocument and xmlNode to create the nodes, I would need to 
> change all my code and use xmlTextWriter?
>
> Bruno
>
> "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message 
> news:uzw9VsdCFHA.3740@TK2MSFTNGP09.phx.gbl...
>> Bruno wrote:
>>
>>> I have a code that generates a xml file and I have some texts that 
>>> contains " ' < > etc....
>>>
>>> how do I encode these texts to have them showed with the characters < " 
>>> ' / > etc...
>>
>> Why doesn't you code use standard XML API for creating XML? Just use 
>> XmlTextWriter to create XML and don't bother about XML syntax 
>> peculiarities - XmlTextWriter takes care.
>>
>> -- 
>> Oleg Tkachenko [XML MVP, MCP]
>> http://blog.tkachenko.com
>
> 


0
dennis5359 (37)
2/3/2005 3:19:34 PM
Reply:

Similar Artilces: