Closed Thread Icon

Topic awaiting preservation: DOM parser (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=25568" title="Pages that link to Topic awaiting preservation: DOM parser (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: DOM parser <span class="small">(Page 1 of 1)</span>\

 
Ritvar
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Apr 2005

posted posted 04-21-2005 14:50

I have a problem with parsing XML.
I have six listBoxes on dialog window - every one has a parent and a child listbox.
They all need to relod values, without refrshing page.

So, I found a solution - first I load an XML file from server:
--------------------------------------------------------------------------
var req;

function loadXMLDoc(url,funkHandle) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = funkHandle;
req.open("POST", url, true);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = funkHandle;
req.open("POST", url, true);
req.send();
}
}
}
------------------------------------------------------------------
------------------------------------------------------------------

then I need to parse it to get DOM object. I can clearly parse it by
Mozilla using DOMParser().
But in IE I meet a problem - ActiveXObject ( Microsoft.XMLDOM )
do not whants to parse it .

XML looks like:
------------------------------------------------------------------
<?xml version="1.0" encoding="windows-1257" ?>
<objects>
<kod val='323'>234234 - some Latvien tekst</kod>
<kod val='323'>234234 - some Latvien tekst</kod>
</objects>
------------------------------------------------------------------
------------------------------------------------------------------

Also I send additional headers:
------------------------------
Content-Type: text/xml
Encoding: windows-1257
------------------------------
------------------------------

And more - even in Mozilla in place of national characters
I see 2 simbols replaced (somewhere it was transfered in Unicode?)

Please help )

Ritvar
Obsessive-Compulsive (I) Inmate

From:
Insane since: Apr 2005

posted posted 04-21-2005 16:30

And more...

--------------------------------
1. Mozilla
I tried just to feed to XMLHttpRequest() simple string in conteiner
with XML header....
It was done OK, but when I parse it with DOMParser() I get a string
containing 2 chars in place of national 1 char.
Ok, I now - I can use responseXML, but - why DOMParser do not accept
well formed string???
--------------------------------
2. IE MS
Problems occure earlier - ActiveXObject(Microsoft.XMLHTTP) after recieving
returns AbbrCadabra string (responseText)
...and in this case (I do not know why) - I can not use responseXML -
returns NULL


P.S.: please excuse me my bad english

(Edited by Ritvar on 04-21-2005 17:22)

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-21-2005 19:20

Only need one post.



.:[ Never resist a perfect moment ]:.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 04-21-2005 20:11

well, the only suggestion my partially fried brain will spit out tonight:

Are you specificing any encoding? ARe you specifing an encoding that can handle your Latvien text?
The one-to-two-character problem might be because your encoding needs 2 bytes to store that character.

so long,

->Tyberius Prime

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-22-2005 18:35

Can you show the code you are using to parse the file?

Whatever is your "funkHandle" function.

This is the fairly straightforward method for passing the request but we need to see what you are doing when you parse it.



.:[ Never resist a perfect moment ]:.

« BackwardsOnwards »

Show Forum Drop Down Menu