Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Issue with double quotes in xml used in a ASP.Net page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
msdnuser - 21 Aug 2007 00:56 GMT
Hi All,

A piece of XML is stored in sql server; retrieved; different UI fields are
filled with appropriate data by fetching data from xml which is stored in sql.

Usually the UI fields after modification are processed; stored in
xmldocument variable; eventually stored in db.

Now one of the UI fields has double quote in the text that it contains.

Now my question is in our development environment , the above mentioned
attribute is replaced with " in the xml document saved to db. But in another
environment it is saved as " itself which is causing problems. When the users
try to open the record next time it throws xml exception.

What is the problem? xml parser? or .net or something else?

recently we switched from 1.1 to 2.0.

Please throw some light on this issue.

Thanks.
Göran Andersson - 21 Aug 2007 09:31 GMT
> Hi All,
>
[quoted text clipped - 9 lines]
> attribute is replaced with " in the xml document saved to db. But in another
> environment it is saved as " itself which is causing problems.

I fail to see the difference between " and ".

> When the users
> try to open the record next time it throws xml exception.
[quoted text clipped - 6 lines]
>
> Thanks.

Signature

Göran Andersson
_____
http://www.guffa.com

msdnuser - 21 Aug 2007 17:20 GMT
The first double quote that I have mentioned in my message is """.

> > Hi All,
> >
[quoted text clipped - 22 lines]
> >
> > Thanks.
msdnuser - 21 Aug 2007 17:32 GMT
Sorry it again converts it to just double quotes. What I am trying to say is

that in my dev environment double quote is stored as "ampersand double quote
semicolon". But in other environments its stored as double quote itself.

> The first double quote that I have mentioned in my message is """.
>
[quoted text clipped - 24 lines]
> > >
> > > Thanks.
Göran Andersson - 21 Aug 2007 20:33 GMT
> Sorry it again converts it to just double quotes.

The term "double quote" is a bit misleading. A quotation mark is ", so a
double quote would be "". The ' character is apostrophe, so " would
rather be "double apostrophe" than "double quote".

(Strictly speaking, " is the character for the inch unit, and ' is the
character for feet unit, but they are used instead of the quotation mark
and apostrophe, as they are not available on a standard keyboard.)

> What I am trying to say is
>
> that in my dev environment double quote is stored as "ampersand double quote
> semicolon". But in other environments its stored as double quote itself.

Neither is correct in an xml document. A quotation mark in a value
should be encoded as " ( & q u o t ; ).

If quotation marks are improperly encoded or not encoded at all, the xml
is invalid, and it's likely that it's impossible to parse it using
normal methods.

Signature

Göran Andersson
_____
http://www.guffa.com

msdnuser - 21 Aug 2007 22:58 GMT
Yes in my dev environment quotation mark is properly encoded while saving to
xml file. But in other environments it is not so. Please explain me if this
encoding will happen automatically when the text in html textarea is stored
in an xml file because I could not understand why this is not happening in
all the environments uniformly.

Thanks.

> > Sorry it again converts it to just double quotes.
>
[quoted text clipped - 17 lines]
> is invalid, and it's likely that it's impossible to parse it using
> normal methods.
Göran Andersson - 02 Sep 2007 14:33 GMT
> Yes in my dev environment quotation mark is properly encoded while saving to
> xml file. But in other environments it is not so. Please explain me if this
> encoding will happen automatically when the text in html textarea is stored
> in an xml file because I could not understand why this is not happening in
> all the environments uniformly.

That depends entirely on how you create the xml file. There is nothing
magical about an xml file, it's just a text file that has a specific format.

If you use some tool for creating the xml, like the XmlDocument object,
it will encode the text that you put in the elements. If you create the
xml by just concatenating strings, there is of course no encoding going
on unless you do it yourself.

Signature

Göran Andersson
_____
http://www.guffa.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.