HI
I want to display the contents of a big XML inside a text area so that the user would be able to edit it. But the XML consists of characters such as & " which are interpreted by as & and " respectively.
But if this going to be the case the backend systems could not read them. I used <xmp>, but it is already deprecated and further it would not work inside text area. Could somebody help me with this.
in short : & should be displayed as & itself and not & inside the textarea.
Vinoth
16 4345 KevinADC 4,059
Recognized Expert Specialist
javascript I am sure can do the proper character escaping, but I don't know how to do it myself. You can also do it server side with PHP or perl or other scripting language. Bascially the & symbol needs to converted to & so & would become &amp; etc etc etc.
AricC 1,892
Recognized Expert Top Contributor
HI
I want to display the contents of a big XML inside a text area so that the user would be able to edit it. But the XML consists of characters such as & " which are interpreted by as & and " respectively.
But if this going to be the case the backend systems could not read them. I used <xmp>, but it is already deprecated and further it would not work inside text area. Could somebody help me with this.
in short : & should be displayed as & itself and not & inside the textarea.
Vinoth
Maybe this is more of an XML question?
javascript I am sure can do the proper character escaping, but I don't know how to do it myself. You can also do it server side with PHP or perl or other scripting language. Bascially the & symbol needs to converted to & so & would become &amp; etc etc etc.
Yeah.Basically the round about would be to do a replace all of & with &amp; and so on which we eventually did in the server side. But I wanted to know if anything could be done in the client side itself.
Thanks a lot anyways.
Maybe this is more of an XML question?
Not necessarily. The question is about the browser marking up the character sets and predominanty HTML stuff and javascript.
thanks
KevinADC 4,059
Recognized Expert Specialist
Yeah.Basically the round about would be to do a replace all of & with &amp; and so on which we eventually did in the server side. But I wanted to know if anything could be done in the client side itself.
Thanks a lot anyways.
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
Thanks Kevin for that. :-)
I am pretty sure javascript can do the escaping, but I don't know how to do that or if in fact it can be done. Ask in the javascripting forum. As far as the browser itself goes, there is no mechanism I know of to do what you want.
I thought on the same lines. But javascript doesnt do anything special here!
These are the things I tried..
1. s=escape('&');
document.writeln("escaped string : "+s);
t=unescape('&');
document.writeln("unescaped string : "+t);
Both returned '&'
2. <xmp>&</xmp> OR <pre>&</pre>
Both were displayed AS IS (ALONG WITH TAGS) inside the text area. But <xmp> did work OUTSIDE the textarea. But not a great idea as its already deprecated!
3. <plaintext> -- NEVER use this! It will BREAK all the HTML code after the <PLAINTEXT> tag..... All the remaining HTML will be displayed AS IS to the user..
KevinADC 4,059
Recognized Expert Specialist
OK, but who said anything about using the <plaintext> tag?
<plaintext>? Are we making up elements as we go along?
You should carry on this javascript discussion on the javascript board.
KevinADC 4,059
Recognized Expert Specialist
<plaintext> is a legitimate html tag, or maybe I don't understand your comment.
No wonder I never heard of it. It was "obsoleted" in HTML 2.0 and listed as deprecated in 3.0 and 3.2. Only some browsers support it but IE and Firefox do not from what I read.
I don't know if rite2 ever got an answer, but if you fetch any text file,
including xml,with an xhtmlHTTPRequest 'GET', and set the value of the textarea to the response text returned, the literal text will be displayed in the text area- &s; <'s, and all.
KevinADC 4,059
Recognized Expert Specialist
No wonder I never heard of it. It was "obsoleted" in HTML 2.0 and listed as deprecated in 3.0 and 3.2. Only some browsers support it but IE and Firefox do not from what I read.
Deprecated is not the same as obsolete, although I believe I understand what you are saying. Even before the tag was deprecated it had no pratical use. I think it was mostly used by mischief makers with great results on unsuspecting html enabled forums, guestbooks, and such.
IE and FireFox do support it, but might not if the DTD is set properly.
AricC 1,892
Recognized Expert Top Contributor
We moving this to javascript? I believe the escape character in JS is \
We moving this to javascript? I believe the escape character in JS is \
Guys !! Thanks a ton for all of your suggestions. In fact we took the fool proof solution of going into the server side.
Mr.Moderator.How can i trace this thread in the JS forum ?
Vinoth
acoder 16,027
Recognized Expert Moderator MVP
Mr.Moderator.How can i trace this thread in the JS forum?
If you want to find your posts/threads, go to your Control Panel (top right-hand corner) and subscribed threads. Alternatively, go to your own user profile (if you can find one of your posts), then click on 'Find all posts by...'.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Cocy |
last post by:
Hi,
This might be a sort of FAQ, but I don't see why,
so I would someone help me to understand what's wrong?
I've just created following code which wold trim
white space(s) in a (given) string....
|
by: TTroy |
last post by:
Hello, I'm relatively new to C and have gone through more than 4 books
on it. None mentioned anything about integral promotion, arithmetic
conversion, value preserving and unsigned preserving. ...
|
by: Pete |
last post by:
Hi all...
I sincerly hope one of the MS guys can clear this up for me...
First some background...
Ok, I have a web site which is fully translatable into several
languages. All the strings...
|
by: KevinADC |
last post by:
Purpose
The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
|
by: rajash |
last post by:
Hello everyone,
Thanks again for all the suggestions, though I think some people are a
bit fussy in their answers.
Here is a solution to Exercise 1.14. It deals well with control
characters...
| |
by: sophia.agnes |
last post by:
Dear all,
I was going through the book "C a software engineering approach by
darnell & Margolis" there was a section named sign preserving vs value
preserving
it is as follows
sign...
|
by: amulyab |
last post by:
Hi,
M using browse button to select a text file.The contents of text is made to display inside text area.Now i have to add some links for the some parts of text which is inside text area.How can i...
|
by: amulyab |
last post by:
Hi,
M using browse button to select a text file.The contents of text is made to display inside text area.Now i have to add some links for the some parts of text which is inside text area.How can i...
|
by: coolguyraj |
last post by:
Hi
i have the following HTML code for the text Area how can i disable the enter key inside the text area.
<td colspan="7"><textarea cols="80" onkeypress="keyhandler<?php echo $x?>()" rows="5"...
|
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...
|
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,...
| |
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |