Thank you Gareth, Frank and Richard.  It worked...  
 
I replaced & with %26 in my servlet and used javascript unescape to to get is 
back they way it should
 
I tried URLEncoder.encode() the values in servlet but it seems that the unscape 
is not converting + to spaces.  In any case, it works.  Thanks so much for your 
time.
 

"Frank W. Zammetti" <[EMAIL PROTECTED]> wrote:
I think he said he tried that, buit now I'm thinking... I think he tried
replacing it with an HTML entity... how about using the URL encoded
version (%27 I think?). Is there maybe an XML-specific way to encode it?
(I would have thought the & entity would have worked frankly, but he
said it didn't).

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, September 6, 2005 12:09 pm, Richard Yee said:
> Is the ampersand part of the XML message being sent
> back to the browser from the servlet? If so, you need
> to escape the ampersand in the servlet before it is
> sent in the servlet response. The ampersand is a
> special character in XML.
>
> -Richard
>
> --- "Frank W. Zammetti" wrote:
>
>> That's kind of what I was afraid of... makes it more
>> difficult to deal with.
>>
>> The getAttribute() method is actually a method of
>> the node object, which
>> is what your dealing with by that point in the code.
>> It's not even an
>> AJAX question at that point. You might try doing
>> items[i].nodeValue
>> instead, or perhaps even .innerHTML might work (note
>> these are properties,
>> not methods)... I lost the XML you sent perviously,
>> and I don't remember
>> if your values were attributes or the content of a
>> tag.
>>
>> The only note of interest I found was that if you
>> are using IE,
>> getAttribute() can return the value as a string,
>> number or boolean,
>> whereas other browsers will return it as a string
>> exclusively... if you
>> happen to be using IE, that could be the problem,
>> and going after the
>> nodeValue itself *might* get around it.
>>
>> --
>> Frank W. Zammetti
>> Founder and Chief Software Architect
>> Omnytex Technologies
>> http://www.omnytex.com
>>
>> On Tue, September 6, 2005 11:37 am,
>> [EMAIL PROTECTED] said:
>> > Gareth, try/catch didn't reveal anything.
>> >
>> > Frank, after numerous alerts, the problem seems to
>> be in getAttribute(...)
>> > function of AJAX:
>> >
>> > for (var i = 0; i < items.length; i++) {
>> > alert("ID:" + items[i].getAttribute('dataID'));
>> > alert("Value:" +
>> items[i].getAttribute('dataValue'));
>> > }
>> >
>> > Here is that AppendValues(...) method
>> >
>> > function AppendValues(col,arr,label)
>> > {
>> > col.options[col.options.length] = new
>> Option(label);
>> > col[col.length-1].value = arr;
>> > }
>> >
>> >
>> > "Frank W. Zammetti" wrote:
>> > Ok, two things...
>> >
>> > (1) Throw an alert in right before the call to
>> AppendValues() :
>> >
>> > alert(items[i].getAttribute('dataID') + " = " +
>> > items[i].getAttribute('dataValue'));
>> >
>> > Make sure you see the ampersand in there.
>> >
>> > (2) Assuming you do see the ampersand in that
>> alert, let's see the code
>> > for AppendValues(), because it has to be where the
>> problem is then.
>> >
>> > Frank
>> >
>> > --
>> > Frank W. Zammetti
>> > Founder and Chief Software Architect
>> > Omnytex Technologies
>> > http://www.omnytex.com
>> >
>> > On Tue, September 6, 2005 10:43 am,
>> [EMAIL PROTECTED] said:
>> >> Here you go Frank:
>> >>
>> >> AJAX CODE:
>> >>
>> >> function getNewXMLHttpRequest() {
>> >> var _req;
>> >> // branch for native XMLHttpRequest object
>> (safari/mozilla)
>> >> if (window.XMLHttpRequest) {
>> >> _req = new XMLHttpRequest();
>> >> }
>> >> // branch for IE/Windows ActiveX version
>> >> else if (window.ActiveXObject) {
>> >> _req = new ActiveXObject("Microsoft.XMLHTTP");
>> >> }
>> >> return _req;
>> >> }
>> >> function getdataValues(fieldname){
>> >> var state =
>> >>
>>
> document.actionForm.state[document.actionForm.state.selectedIndex].value;
>> >> var url = "getXMLValues.jsp?state="+state;
>> >> var xmlhttp = getNewXMLHttpRequest();
>> >> xmlhttp.open("GET",url,true);
>> >> xmlhttp.onreadystatechange = function() {
>> >> if (xmlhttp.readyState == 4) {
>> >> if (xmlhttp.responseXML != null) {
>> >> var items =
>> >>
>> xmlhttp.responseXML.getElementsByTagName("dataSet");
>> >> var culumnname = eval("document.actionForm." +
>> fieldname);
>> >> for (var i = 0; i < items.length; i++) {
>> >> AppendValues(culumnname,
>> items[i].getAttribute('dataID'),
>> >> items[i].getAttribute('dataValue'));
>> >> }
>> >> culumnname.selectedIndex=0;
>> >> }
>> >> }
>> >> }
>> >> xmlhttp.send(null);
>> >> }
>> >>
>> >>
>> >> JSP CODE:
>> >> > Select a State>
>> >> > Select a Country>
>> >>
>> >> SERVLET CODE (modified...)
>> >>
>> >> ( multiple checks...)
>> >> if (state != null && state.length() > 0) {
>> >> searchFor = "COUNTRY_ID, COUNTRY_NAME";
>> >> whereIs= "STATE = '" + state + "'";
>> >> }
>> >>
>> >> sql = "SELECT " + searchFor + " FROM DATA_TABLE
>> WHERE " + whereIs;
>> >>
>> >> Compile data from that query to xml and return to
>> browser.
>> >> eg:
>> >> > dataValue="United States & US Vargin Islands"
>> />>
>> >> dataValue="Australia" />
>> >>
>> >>
>> >>
>> >> "Frank W. Zammetti" wrote:
>> >> Let me see if I'm all caught up here (I'm just
>> back to work from
>> >> vacation
>> >> today, so my brain isn't fully engaged yet)...
>> >>
>> >> Everything works as expected up until the point
>> you try to populate the
>> >> dropdown on the client, correct? The XML you get
>> back from the servlet
>> >> is
>> >> correct, so the problem lies somewhere in the
>> code to populate the
>> >> dropdown. Sound about right?
>> >>
>> >> If so, can you post said code? We might be able
>> to spot something there.
>> >> Off-hand I can't think of what the problem might
>> be, I don't think I've
>> >> ever seen this before... I did see some issues
>> with internationalized
>> >> data
>> >> at one point, but ampersand I don't think falls
>> in that category.
>> >>
>> >> --
>> >> Frank W. Zammetti
>> >> Founder and Chief Software Architect
>> >> Omnytex Technologies
>> >> http://www.omnytex.com
>> >>
>> >> On Tue, September 6, 2005 10:16 am,
>> [EMAIL PROTECTED] said:
>> >>> Gareth, you are correct abut ajax being
>> independent. In my case, the
>> >>> interesting thing is that the servlet is using
>> database to look up the
>> >>> data and requires where cause as a parameter so
>> that it can generate a
>> >>> query, retrieve data from database, create xml
>> to be passed to the
>> >>> calling
>> >>> .jsp page.:
>> >>>
>> >>> i.e.: here are the steps
>> >>>
>> >>> 1. onchange() getdataValues.jsp?state='NY'
>> >>> 2. in servlet, ( multiple checks...)
>> >>> if (state != null && state.length() > 0)
>> >>> {
>>
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to