Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 7th, 2007, 07:05 PM
Jo M
Guest
 
Posts: n/a
Default Still one question!

Hello again!

I wrote a small Windows App that converts
characters to XML.

Code below:
StringBuilder sb = new StringBuilder();

new System.Xml.XmlTextWriter(new

StringWriter(sb)).WriteString(this.txtBoxFrom.Text );

this.txtBoxTo.Text = sb.ToString();

If I give & to txtBoxFrom field it writes & to txtBoxTo field

but when givin " it writes " not " that it should write.

Can anyone point what is still missing?

Cheers!


  #2  
Old March 8th, 2007, 01:15 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Still one question!

Jo M wrote:
Quote:
If I give & to txtBoxFrom field it writes & to txtBoxTo field
>
but when givin " it writes " not " that it should write.
>
Can anyone point what is still missing?
" is allowed in XML, there is no need to escape it unless you use it
inside of an attribute value where the value is already delimited by
double quotes. Thus if you want to write XML markup that is properly
escaped then write the complete markup with an XmlWriter, it has methods
to write out attributes and will do all escaping necessary. The snippet
you used does not write an attribute value so there no escaping of the
double quote is necessary.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles