HighDots Forums  

Re: XML Islands in Firefox

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: XML Islands in Firefox in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tomicmilan@gmail.com
 
Posts: n/a

Default Re: XML Islands in Firefox - 01-30-2008 , 06:07 AM






Yes, I know I can not trust innerHTML. That is why I am asking for
help here. I have already seen the link you posted but it didn't
helped me.

With document.getElementById("zahtevek") I get a reference to <xml>
element but I don't know how to extract XML as a string from it. :
( That is the problem.

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: XML Islands in Firefox - 01-30-2008 , 06:16 AM






tomicmilan (AT) gmail (DOT) com wrote:
Quote:
Yes, I know I can not trust innerHTML. That is why I am asking for
help here. I have already seen the link you posted but it didn't
helped me.

With document.getElementById("zahtevek") I get a reference to <xml
element but I don't know how to extract XML as a string from it. :
( That is the problem.
Firefox does not support XML data islands in HTML documents. However you
can use XMLHttpRequest to load an XML document and access its DOM as
responseXML. That works for IE too.

--

Martin Honnen
http://JavaScript.FAQTs.com/


Reply With Quote
  #3  
Old   
Bart Van der Donck
 
Posts: n/a

Default Re: XML Islands in Firefox - 01-30-2008 , 06:41 AM



tomicmi... (AT) gmail (DOT) com wrote:

Quote:
Yes, I know I can not trust innerHTML. That is why I am asking for
help here. I have already seen the link you posted but it didn't
helped me.

With document.getElementById("zahtevek") I get a reference to <xml
element but I don't know how to extract XML as a string from it. :
( That is the problem.
Maybe you could use <textarea> in stead of <div>:

<form method="get" action="#">
<textarea cols="60" rows="10" name="zahtevek">
<xml id="zahtevek">
<cdocument xmlns:cd="http://Document">
<cdata Id="Data"/>
</cdocument>
</xml>
</textarea>
<input type="button" name="Test" value="Test"
onclick="alert(document.forms[0].zahtevek.value);">
</form>

With CSS and onFocus="blur()" it looks identical as a div.

--
Bart


Reply With Quote
  #4  
Old   
tomicmilan@gmail.com
 
Posts: n/a

Default Re: XML Islands in Firefox - 01-30-2008 , 10:47 AM



On 30 jan., 12:41, Bart Van der Donck <b... (AT) nijlen (DOT) com> wrote:
Quote:
tomicmi... (AT) gmail (DOT) com wrote:
Yes, I know I can not trust innerHTML. That is why I am asking for
help here. I have already seen the link you posted but it didn't
helped me.

With document.getElementById("zahtevek") I get a reference to <xml
element but I don't know how to extract XML as a string from it. :
( That is the problem.

Maybe you could use <textarea> in stead of <div>:

form method="get" action="#"
textarea cols="60" rows="10" name="zahtevek"
xml id="zahtevek"
cdocument xmlns:cd="http://Document"
cdata Id="Data"/
/cdocument
/xml
/textarea
input type="button" name="Test" value="Test"
onclick="alert(document.forms[0].zahtevek.value);"
/form

With CSS and onFocus="blur()" it looks identical as a div.

--
Bart
I have tried that today but it doesn't work for me. Special characters
(©ÐÈÆ®¹ðèæ¾) are not properly handled when placed into and taken from
an textarea. I will have to follow Martin's advice and use
XMLHttpRequest.


Reply With Quote
  #5  
Old   
Bart Van der Donck
 
Posts: n/a

Default Re: XML Islands in Firefox - 01-30-2008 , 12:11 PM



tomicmi... (AT) gmail (DOT) com wrote:

Quote:
Bart Van der Donck wrote:

* * <form method="get" action="#"
* * <textarea cols="60" rows="10" name="zahtevek"
* * <xml id="zahtevek"
* * *<cdocument xmlns:cd="http://Document"
* * * <cdata Id="Data"/
* * *</cdocument
* * </xml
* * </textarea
* * <input type="button" name="Test" value="Test"
* * *onclick="alert(document.forms[0].zahtevek.value);"
* * </form

I have tried that today but it doesn't work for me. Special characters
(©ÐÈÆ®¹ðèæ¾) are not properly handled when placed intoand taken from
an textarea. I will have to follow Martin's advice and use
XMLHttpRequest.
If I'm receiving your encoding correctly, this looks like a two-byte
encoded UTF-8 string. The character set of the page + how it was saved
determine how it will be displayed. You appear to post from Slovenia,
so either you could use ISO-8859-2 (or one of the proprietary Central-
European code pages), or, preferably, UTF-8.

Two examples:

http://www.dotinternet.be/temp/1.htm (saved in UTF-8)
versus
http://www.dotinternet.be/temp/2.htm (not saved in UTF-8!)

My guess what you are seeing:
http://www.dotinternet.be/temp/3.htm

With this in mind, <textarea> should always return the right
characters.

--
Bart


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.