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

G

Guest

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

Guest

msdnuser said:
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.

I fail to see the difference between " and ".
 
G

Guest

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.
 
G

Guest

msdnuser said:
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.
 
G

Guest

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.
 
G

Guest

msdnuser said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top