Getting element with specified ID (eg.
id="id1") from XML file received via xmlHttpRequest is really hard!
var ajax = new XMLHttpRequest();
You know what would happen? Script will fail (in Firefox and Opera; Chrome will do fine) in this line:
It’s obvious that you cannot convert
doc.getElementById('id1') to object, right?
If not - go ahead.
Your browser does not know (or does not want to know), that
id="" is really a unique identifier.
Everything will start to work when, at the beginning of an XML file, we put:
<!DOCTYPE xml [ <!ATTLIST tenelement id ID #IMPLIED> ]>
Until… we would try to send this document to the server:
var ajax2 = new XMLHttpRequest();
Browser will send the DOCTYPE, but without the most important thing (
[ <!ATTLIST tenelement id ID #IMPLIED> ]).
To make it work, I had to modify the received file in save.php by adding a missing part of a DOCTYPE.
Someone knows a better solution?