[thelist] RE: PHP & COM on Windows

Tim Massey Tim.Massey at itrm.co.uk
Tue Aug 2 09:58:01 CDT 2005


Not if its been validated before doing anything risky ; )

I'll be running it through such validation before inserting it into our
database.


This sounds like a very very insecure app to me. I can upload some
malformed DOC and you will paste it into notepad on your box. I am
sure that can be abused badly. Why don't you just parse the DOC once
it was uploaded instead?

--=20
Chris Heilmann=20
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/ =20
Binaries: http://www.onlinetools.org/
------------------------------

Date: Tue, 2 Aug 2005 11:17:01 +0100
From: Paul Waring <paul at xk7.net>
To: thelist at lists.evolt.org
Subject: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <20050802101701.GA91720 at kryten.xk7.net>
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
boundary="WIyZ46R2i8wDzkSu"
MIME-Version: 1.0
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 14


--WIyZ46R2i8wDzkSu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I've currently got a relatively simple XML file that is structured like
so:

<?xml version=3D"1.0" ?>
<sites>
	<site id=3D"10">Site name 1</site>
	<site id=3D"11">Site name 2</site>
	[several more lines like the above]
</sites>

I've managed to get JavaScript to read in the whole file, using some
code that I found on Site Point, and I'm getting the document using:

response =3D req.responseXML.documentElement;

where req is an instance of XMLHttpRequest() (or ActiveXObject in IE,
but I'm testing in Firefox first just to see if I can get *something* to
work). This is only set after I've checked that req.readyState is equal
to 4 and the response code is 200 (i.e. everything's gone ok with
regards to reading the document in). I then have the following two lines
of code, just for testing at the moment:

var sites =3D response.getElementsByTagName('sites');
var sites2 =3D response.getElementsByTagName('site');

Based on what I've read the getElementsByTagName() function to do, I
expect the first line to get back an array of one element containing
the first (and in this case only) <sites> tag, which I could then use to
further traverse the tree using sites[0].getElementsByTagName('site').
However, sites is being set to an undefined value and printing its
length gives 0, but sites2 is being set to an array of size 41, which is
correct.

Have I done something obviously wrong? It seems to me like response is
already pointing to what I would expect sites[0] to be, but I want it to
instead hold the root of the XML document otherwise when I add extra
stuff later I won't be able to traverse it properly. I honestly don't
understand why this isn't working as I've just taken the majority of the
code from an article[1] and simply changed the names to reflect my
document structure.

Thanks in advance,

Paul

[1] http://www.sitepoint.com/print/xml-javascript-mozilla

--=20
Rogue Tory
http://www.roguetory.org.uk

--WIyZ46R2i8wDzkSu--
------------------------------

Date: Tue, 2 Aug 2005 14:49:17 +0300
From: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?= <volkan.ozcelik at gmail.com>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <dfc81b09050802044934bbec41 at mail.gmail.com>
In-Reply-To: <20050802101701.GA91720 at kryten.xk7.net>
References: <20050802101701.GA91720 at kryten.xk7.net>
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Precedence: list
Reply-To: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?=
<volkan.ozcelik at gmail.com>,
	"thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 15

Not surprisingly, mozilla (firefox) and ie define XHR (XmlHttpRequest)
differently.

To work things correct you may use a wrapper:

_this =3D XHRequest.prototype;
function XHRequest(){}
_this.getObject =3D function() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    else {
        alert("XML HTTP Request support cannot be found!");
        return null;
    }
};

var XHR =3D new XHRequest();

you can now use XHR just the same way you use XMLHTTPRequest.

[
Code extracted from my somewhat-related article
(http://www.codeproject.com/jscript/PseudoPopUp.asp)
]

Hope I understood correctly and hope that helps.

Volkan.

On 8/2/05, Paul Waring <paul at xk7.net> wrote:
> I've currently got a relatively simple XML file that is structured
like
> so:
>=20
> <?xml version=3D"1.0" ?>
> <sites>
>        <site id=3D"10">Site name 1</site>
>        <site id=3D"11">Site name 2</site>
>        [several more lines like the above]
> </sites>
>=20
> I've managed to get JavaScript to read in the whole file, using some
> code that I found on Site Point, and I'm getting the document using:
>=20
> response =3D req.responseXML.documentElement;
>=20
> where req is an instance of XMLHttpRequest() (or ActiveXObject in IE,
> but I'm testing in Firefox first just to see if I can get *something*
to
> work). This is only set after I've checked that req.readyState is
equal
> to 4 and the response code is 200 (i.e. everything's gone ok with
> regards to reading the document in). I then have the following two
lines
> of code, just for testing at the moment:
>=20
> var sites =3D response.getElementsByTagName('sites');
> var sites2 =3D response.getElementsByTagName('site');
>=20
> Based on what I've read the getElementsByTagName() function to do, I
> expect the first line to get back an array of one element containing
> the first (and in this case only) <sites> tag, which I could then use
to
> further traverse the tree using sites[0].getElementsByTagName('site').
> However, sites is being set to an undefined value and printing its
> length gives 0, but sites2 is being set to an array of size 41, which
is
> correct.
>=20
> Have I done something obviously wrong? It seems to me like response is
> already pointing to what I would expect sites[0] to be, but I want it
to
> instead hold the root of the XML document otherwise when I add extra
> stuff later I won't be able to traverse it properly. I honestly don't
> understand why this isn't working as I've just taken the majority of
the
> code from an article[1] and simply changed the names to reflect my
> document structure.
>=20
> Thanks in advance,
>=20
> Paul
>=20
> [1] http://www.sitepoint.com/print/xml-javascript-mozilla
>=20
> --
> Rogue Tory
> http://www.roguetory.org.uk
>=20
>=20
> --
>=20
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>=20
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>=20
>=20
>
------------------------------

Date: Tue, 2 Aug 2005 14:51:54 +0300
From: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?= <volkan.ozcelik at gmail.com>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <dfc81b090508020451314e6fc at mail.gmail.com>
In-Reply-To: <dfc81b09050802044934bbec41 at mail.gmail.com>
References: <20050802101701.GA91720 at kryten.xk7.net>
	 <dfc81b09050802044934bbec41 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-9
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Precedence: list
Reply-To: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?=
<volkan.ozcelik at gmail.com>,
	"thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 16

c29ycnkgSSBtaXN1bmRlcnN0b29kLCB5b3VyIGNvZGUgd2FzIGZvciBtb3ppbGxhLgpmb3Jn
ZXQg
YWJvdXQgbXkgcG9zdC4KClZvbGthbi4KCk9uIDgvMi8wNSwgVk9MS0FOINZax0VM3UsgPHZv
bGth
bi5vemNlbGlrQGdtYWlsLmNvbT4gd3JvdGU6Cj4gTm90IHN1cnByaXNpbmdseSwgbW96aWxs
YSAo
ZmlyZWZveCkgYW5kIGllIGRlZmluZSBYSFIgKFhtbEh0dHBSZXF1ZXN0KQo+IGRpZmZlcmVu
dGx5
Lgo+IAo+IFRvIHdvcmsgdGhpbmdzIGNvcnJlY3QgeW91IG1heSB1c2UgYSB3cmFwcGVyOgo+
IAo+
IF90aGlzID0gWEhSZXF1ZXN0LnByb3RvdHlwZTsKPiBmdW5jdGlvbiBYSFJlcXVlc3QoKXt9
Cj4g
X3RoaXMuZ2V0T2JqZWN0ID0gZnVuY3Rpb24oKSB7Cj4gICAgaWYgKHdpbmRvdy5YTUxIdHRw
UmVx
dWVzdCkgewo+ICAgICAgICByZXR1cm4gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7Cj4gICAgfQo+
ICAg
IGVsc2UgaWYgKHdpbmRvdy5BY3RpdmVYT2JqZWN0KSB7Cj4gICAgICAgIHJldHVybiBuZXcg
QWN0
aXZlWE9iamVjdCgiTWljcm9zb2Z0LlhNTEhUVFAiKTsKPiAgICB9Cj4gICAgZWxzZSB7Cj4g
ICAg
ICAgIGFsZXJ0KCJYT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b20gYW4gYXJ0aWNsZVsxXSBhbmQgc2ltcGx5IGNoYW5nZWQgdGhlIG5h
bWVz
IHRvIHJlZmxlY3QgbXkKPiA+IGRvY3VtZW50IHN0cnVjdHVyZS4KPiA+Cj4gPiBUaGFua3Mg
aW4g
YWR2YW5jZSwKPiA+Cj4gPiBQYXVsCj4gPgo+ID4gWzFdIGh0dHA6Ly93d3cuc2l0ZXBvaW50
LmNv
bS9wcmludC94bWwtamF2YXNjcmlwdC1tb3ppbGxhCj4gPgo+ID4gLS0KPiA+IFJvZ3VlIFRv
cnkK
PiA+IGh0dHA6Ly93d3cucm9ndWV0b3J5Lm9yZy51awo+ID4KPiA+Cj4gPiAtLQo+ID4KPiA+
ICog
KiBQbGVhc2Ugc3VwcG9ydCB0aGUgY29tbXVuaXR5IHRoYXQgc3VwcG9ydHMgeW91LiAgKiAq
Cj4g
PiBodHRwOi8vZXZvbHQub3JnL2hlbHBfc3VwcG9ydF9ldm9sdC8KPiA+Cj4gPiBGb3IgdW5z
dWJz
Y3JpYmUgYW5kIG90aGVyIG9wdGlvbnMsIGluY2x1ZGluZyB0aGUgVGlwIEhhcnZlc3Rlcgo+
ID4g
YW5kIGFyY2hpdmVzIG9mIHRoZWxpc3QgZ28gdG86IGh0dHA6Ly9saXN0cy5ldm9sdC5vcmcK
PiA+
IFdvcmtlcnMgb2YgdGhlIFdlYiwgZXZvbHQgIQo+ID4KPiA+Cj4gPgo+Cg==
------------------------------

Date: Tue, 2 Aug 2005 13:03:13 +0100
From: Paul Waring <paul at xk7.net>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <20050802120313.GB91746 at kryten.xk7.net>
In-Reply-To: <dfc81b09050802044934bbec41 at mail.gmail.com>
References: <20050802101701.GA91720 at kryten.xk7.net>
	<dfc81b09050802044934bbec41 at mail.gmail.com>
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
boundary="+g7M9IMkV8truYOl"
MIME-Version: 1.0
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 17


--+g7M9IMkV8truYOl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 02, 2005 at 02:49:17PM +0300, VOLKAN ?Z?EL?K wrote:
> Not surprisingly, mozilla (firefox) and ie define XHR (XmlHttpRequest)
> differently.
>=20
> To work things correct you may use a wrapper:

I'm already using a wrapper that returns either an ActiveXObject or a
XMLHttpRequest. Both browsers have the same problem of not starting with
the <sites> node, although I'm mostly testing in Firefox as it has the
extremely useful JavaScript console.

Paul

--=20
Rogue Tory
http://www.roguetory.org.uk

--+g7M9IMkV8truYOl--
------------------------------

Date: Tue, 2 Aug 2005 15:17:53 +0300
From: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?= <volkan.ozcelik at gmail.com>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <dfc81b0905080205174555eb81 at mail.gmail.com>
In-Reply-To: <20050802120313.GB91746 at kryten.xk7.net>
References: <20050802101701.GA91720 at kryten.xk7.net>
	 <dfc81b09050802044934bbec41 at mail.gmail.com>
	 <20050802120313.GB91746 at kryten.xk7.net>
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Precedence: list
Reply-To: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?=
<volkan.ozcelik at gmail.com>,
	"thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 18

it should work imho.=20
may you give a url to test?

Cheers,
Volkan.

On 8/2/05, Paul Waring <paul at xk7.net> wrote:
> On Tue, Aug 02, 2005 at 02:49:17PM +0300, VOLKAN ?Z?EL?K wrote:
> > Not surprisingly, mozilla (firefox) and ie define XHR
(XmlHttpRequest)
> > differently.
> >
> > To work things correct you may use a wrapper:
>=20
> I'm already using a wrapper that returns either an ActiveXObject or a
> XMLHttpRequest. Both browsers have the same problem of not starting
with
> the <sites> node, although I'm mostly testing in Firefox as it has the
> extremely useful JavaScript console.
>=20
> Paul
>=20
> --
> Rogue Tory
> http://www.roguetory.org.uk
>=20
>=20
> --
>=20
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>=20
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>=20
>=20
>
------------------------------

Date: Tue, 02 Aug 2005 14:24:34 +0200
From: marcus <m-lists at bristav.se>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <42EF6602.9090601 at bristav.se>
In-Reply-To: <20050802101701.GA91720 at kryten.xk7.net>
References: <20050802101701.GA91720 at kryten.xk7.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 19

responseXML.documentElement is the root element of the document. What is

happening is perfectly correct. I don't see the problem.

What do you want to do that you apparantly can't when operating directly

on the documentElement?

/Marcus

Paul Waring wrote:

>I've currently got a relatively simple XML file that is structured like
>so:
>
><?xml version="1.0" ?>
><sites>
>	<site id="10">Site name 1</site>
>	<site id="11">Site name 2</site>
>	[several more lines like the above]
></sites>
>
>I've managed to get JavaScript to read in the whole file, using some
>code that I found on Site Point, and I'm getting the document using:
>
>response = req.responseXML.documentElement;
>
>Have I done something obviously wrong? It seems to me like response is
>already pointing to what I would expect sites[0] to be, but I want it
to
>instead hold the root of the XML document otherwise when I add extra
>stuff later I won't be able to traverse it properly. I honestly don't
>understand why this isn't working as I've just taken the majority of
the
>code from an article[1] and simply changed the names to reflect my
>document structure.
>
>Thanks in advance,
>
>Paul
>
>[1] http://www.sitepoint.com/print/xml-javascript-mozilla
>
>  
>


------------------------------

Date: Tue, 2 Aug 2005 15:31:43 +0300
From: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?= <volkan.ozcelik at gmail.com>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <dfc81b090508020531182bb2b3 at mail.gmail.com>
In-Reply-To: <42EF6602.9090601 at bristav.se>
References: <20050802101701.GA91720 at kryten.xk7.net>
	 <42EF6602.9090601 at bristav.se>
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Precedence: list
Reply-To: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?=
<volkan.ozcelik at gmail.com>,
	"thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 20

> responseXML.documentElement is the root element of the document. What
is
> happening is perfectly correct. I don't see the problem.
>=20

if so, something like this will sort out the issue.

<documentroot>
<sites>
       <site id=3D"10">Site name 1</site>
       <site id=3D"11">Site name 2</site>
       [several more lines like the above]
</sites>

...


</documentroot>


Cheers,
Volkan.


> What do you want to do that you apparantly can't when operating
directly
> on the documentElement?
>=20
> /Marcus
>=20
> Paul Waring wrote:
>=20
> >I've currently got a relatively simple XML file that is structured
like
> >so:
> >
> ><?xml version=3D"1.0" ?>
> ><sites>
> >       <site id=3D"10">Site name 1</site>
> >       <site id=3D"11">Site name 2</site>
> >       [several more lines like the above]
> ></sites>
> >
> >I've managed to get JavaScript to read in the whole file, using some
> >code that I found on Site Point, and I'm getting the document using:
> >
> >response =3D req.responseXML.documentElement;
> >
> >Have I done something obviously wrong? It seems to me like response
is
> >already pointing to what I would expect sites[0] to be, but I want it
to
> >instead hold the root of the XML document otherwise when I add extra
> >stuff later I won't be able to traverse it properly. I honestly don't
> >understand why this isn't working as I've just taken the majority of
the
> >code from an article[1] and simply changed the names to reflect my
> >document structure.
> >
> >Thanks in advance,
> >
> >Paul
> >
> >[1] http://www.sitepoint.com/print/xml-javascript-mozilla
> >
> >
> >
>=20
>=20
> --
>=20
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>=20
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
------------------------------

Date: Tue, 2 Aug 2005 13:35:48 +0100
From: Paul Waring <paul at xk7.net>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <20050802123548.GA92253 at kryten.xk7.net>
In-Reply-To: <42EF6602.9090601 at bristav.se>
References: <20050802101701.GA91720 at kryten.xk7.net>
	<42EF6602.9090601 at bristav.se>
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 21

On Tue, Aug 02, 2005 at 02:24:34PM +0200, marcus wrote:
> responseXML.documentElement is the root element of the document. What
is 
> happening is perfectly correct. I don't see the problem.

When I changed the code to:

response.req.responseXML;

it works the way I want, but surely <sites> isn't the root element of
the document because what would happen if I had say:

<sites><site id="10">site 1</site></sites>
<companies><company id="10">company 1</company></companies>

which one would responseXML.documentElement point at then? Or would it
be an array (meaning I'd have more than one root element, which I would
have thought is incorrect)?

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk
------------------------------

Date: Tue, 2 Aug 2005 15:45:55 +0300
From: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?= <volkan.ozcelik at gmail.com>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <dfc81b0905080205452b002c8e at mail.gmail.com>
In-Reply-To: <20050802123548.GA92253 at kryten.xk7.net>
References: <20050802101701.GA91720 at kryten.xk7.net>
	 <42EF6602.9090601 at bristav.se>
<20050802123548.GA92253 at kryten.xk7.net>
Content-Type: text/plain; charset=ISO-8859-1
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Precedence: list
Reply-To: =?ISO-8859-9?Q?VOLKAN_=D6Z=C7EL=DDK?=
<volkan.ozcelik at gmail.com>,
	"thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 22

<sites><site id=3D"10">site 1</site></sites>
<companies><company id=3D"10">company 1</company></companies>

this is not a valid XML, each xml ought to have a topmost root node.

Or did I miss something again?


On 8/2/05, Paul Waring <paul at xk7.net> wrote:
> On Tue, Aug 02, 2005 at 02:24:34PM +0200, marcus wrote:
> > responseXML.documentElement is the root element of the document.
What i=
s
> > happening is perfectly correct. I don't see the problem.
>=20
> When I changed the code to:
>=20
> response.req.responseXML;
>=20
> it works the way I want, but surely <sites> isn't the root element of
> the document because what would happen if I had say:
>=20
> <sites><site id=3D"10">site 1</site></sites>
> <companies><company id=3D"10">company 1</company></companies>
>=20
> which one would responseXML.documentElement point at then? Or would it
> be an array (meaning I'd have more than one root element, which I
would
> have thought is incorrect)?
>=20
> Paul
>=20
> --
> Rogue Tory
> http://www.roguetory.org.uk
> --
>=20
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>=20
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
------------------------------

Date: Tue, 02 Aug 2005 14:49:11 +0200
From: marcus <m-lists at bristav.se>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <42EF6BC7.6060507 at bristav.se>
In-Reply-To: <20050802123548.GA92253 at kryten.xk7.net>
References: <20050802101701.GA91720 at kryten.xk7.net>
	<42EF6602.9090601 at bristav.se>
<20050802123548.GA92253 at kryten.xk7.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 23

That kind of document would be illegal since all XML documents must have

one and only one document root/element.

/Marcus

Paul Waring wrote:
> On Tue, Aug 02, 2005 at 02:24:34PM +0200, marcus wrote:
> 
>>responseXML.documentElement is the root element of the document. What
is 
>>happening is perfectly correct. I don't see the problem.
> 
> 
> When I changed the code to:
> 
> response.req.responseXML;
> 
> it works the way I want, but surely <sites> isn't the root element of
> the document because what would happen if I had say:
> 
> <sites><site id="10">site 1</site></sites>
> <companies><company id="10">company 1</company></companies>
> 
> which one would responseXML.documentElement point at then? Or would it
> be an array (meaning I'd have more than one root element, which I
would
> have thought is incorrect)?
> 
> Paul
> 


------------------------------

Date: Tue, 2 Aug 2005 13:58:17 +0100
From: Paul Waring <paul at xk7.net>
To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Subject: Re: [thelist] Problems traversing XML tree in JavaScript
Message-ID: <20050802125817.GB92253 at kryten.xk7.net>
In-Reply-To: <dfc81b0905080205452b002c8e at mail.gmail.com>
References: <20050802101701.GA91720 at kryten.xk7.net>
	<42EF6602.9090601 at bristav.se>
<20050802123548.GA92253 at kryten.xk7.net>
	<dfc81b0905080205452b002c8e at mail.gmail.com>
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Precedence: list
Reply-To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
Message: 24

On Tue, Aug 02, 2005 at 03:45:55PM +0300, VOLKAN ?Z?EL?K wrote:
> <sites><site id="10">site 1</site></sites>
> <companies><company id="10">company 1</company></companies>
> 
> this is not a valid XML, each xml ought to have a topmost root node.

Ah, I thought the root node was basically everything between <?xml ?>
and the end of the document, didn't think you had to specifically define
one (can't really see why you'd want to, or give it a name, seeing as
you'd probably always just refer to it as the root node anyway).

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk
------------------------------

_______________________________________________
Help: http://lists.evolt.org/mailman/listinfo/thelist

Archives: http://lists.evolt.org

End of thelist Digest, Vol 30, Issue 2
**************************************


More information about the thelist mailing list