You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Devesh Mishra <De...@mastek.com> on 2013/04/11 07:53:29 UTC

appendChild VS insertChildBefore - XML Methods

Hi,
I just came across an issue regarding appendChild method to append a xml. I am sure everyone must be familiar with this method.
At some point while debugging my code, I found that it's not appending child i.e. after executing my code in which I have written,
var xml:XML = <Data></Data>;
xml.appendChild(<ChildData></ ChildData>);
After executing these lines of code, I found that my xml have no ChildData tag. Then I have to use insertChildBefore method as an alternate i.e.
xml.insertChildBefore(null, <ChildData></ ChildData>);
It worked for me. But I want to know the exact reason behind this unknown behaviour of appendChild method. It's not happening everything. Somewhere it works and somewhere it doesn't.
May be it's a compiler issue or something else.
--
Thanks & Regards,
[cid:image001.gif@01CE36A5.8FBDD6D0] Devesh Mishra | Sr. Software Engineer
Mastek Ltd. | NA P&C Division | Mobile: +91-8097032750
Phone: 022-67914646 (5222)

MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RE: appendChild VS insertChildBefore - XML Methods

Posted by Devesh Mishra <De...@mastek.com>.
Hi,
I am also using same sdk which you are using. As I told earlier, this doesn't happens every time. I got very few instances(1 or 2%) which I came across with such issues.

-----Original Message-----
From: Michael Baird [mailto:mbaird@kairyt.com] 
Sent: 11 April 2013 23:02
To: users@flex.apache.org
Subject: Re: appendChild VS insertChildBefore - XML Methods

Which Flex SDK are you using? Can you provide a sample application?

I tried in 4.1.0 and 4.6.0 and it's working with a very simple test case:

private function onCreationComplete():void {
 var xml:XML = <Data></Data>;
xml.appendChild(<ChildData></ ChildData>);
 trace(xml);
 }

//... in console
<Data>
  <ChildData/>
</Data>


On Wed, Apr 10, 2013 at 10:54 PM, Virat Patil <Vi...@mastek.com>wrote:

> I have Faced the same issue as well
>
> From: Devesh Mishra
> Sent: Thursday, April 11, 2013 11:23 AM
> To: flex-users@incubator.apache.org; users@flex.apache.org
> Subject: appendChild VS insertChildBefore - XML Methods
>
> Hi,
> I just came across an issue regarding appendChild method to append a xml.
> I am sure everyone must be familiar with this method.
> At some point while debugging my code, I found that it's not appending
> child i.e. after executing my code in which I have written,
> var xml:XML = <Data></Data>;
> xml.appendChild(<ChildData></ ChildData>);
> After executing these lines of code, I found that my xml have no ChildData
> tag. Then I have to use insertChildBefore method as an alternate i.e.
> xml.insertChildBefore(null, <ChildData></ ChildData>);
> It worked for me. But I want to know the exact reason behind this unknown
> behaviour of appendChild method. It's not happening everything. Somewhere
> it works and somewhere it doesn't.
> May be it's a compiler issue or something else.
> --
> Thanks & Regards,
> [cid:image001.gif@01CE36A5.8FBDD6D0]Devesh Mishra | Sr. Software Engineer
> Mastek Ltd. | NA P&C Division | Mobile: +91-8097032750
> Phone: 022-67914646 (5222)
>
>
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: appendChild VS insertChildBefore - XML Methods

Posted by Michael Baird <mb...@kairyt.com>.
Which Flex SDK are you using? Can you provide a sample application?

I tried in 4.1.0 and 4.6.0 and it's working with a very simple test case:

private function onCreationComplete():void {
 var xml:XML = <Data></Data>;
xml.appendChild(<ChildData></ ChildData>);
 trace(xml);
 }

//... in console
<Data>
  <ChildData/>
</Data>


On Wed, Apr 10, 2013 at 10:54 PM, Virat Patil <Vi...@mastek.com>wrote:

> I have Faced the same issue as well
>
> From: Devesh Mishra
> Sent: Thursday, April 11, 2013 11:23 AM
> To: flex-users@incubator.apache.org; users@flex.apache.org
> Subject: appendChild VS insertChildBefore - XML Methods
>
> Hi,
> I just came across an issue regarding appendChild method to append a xml.
> I am sure everyone must be familiar with this method.
> At some point while debugging my code, I found that it's not appending
> child i.e. after executing my code in which I have written,
> var xml:XML = <Data></Data>;
> xml.appendChild(<ChildData></ ChildData>);
> After executing these lines of code, I found that my xml have no ChildData
> tag. Then I have to use insertChildBefore method as an alternate i.e.
> xml.insertChildBefore(null, <ChildData></ ChildData>);
> It worked for me. But I want to know the exact reason behind this unknown
> behaviour of appendChild method. It's not happening everything. Somewhere
> it works and somewhere it doesn't.
> May be it's a compiler issue or something else.
> --
> Thanks & Regards,
> [cid:image001.gif@01CE36A5.8FBDD6D0]Devesh Mishra | Sr. Software Engineer
> Mastek Ltd. | NA P&C Division | Mobile: +91-8097032750
> Phone: 022-67914646 (5222)
>
>
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

RE: appendChild VS insertChildBefore - XML Methods

Posted by Virat Patil <Vi...@mastek.com>.
I have Faced the same issue as well

From: Devesh Mishra
Sent: Thursday, April 11, 2013 11:23 AM
To: flex-users@incubator.apache.org; users@flex.apache.org
Subject: appendChild VS insertChildBefore - XML Methods

Hi,
I just came across an issue regarding appendChild method to append a xml. I am sure everyone must be familiar with this method.
At some point while debugging my code, I found that it's not appending child i.e. after executing my code in which I have written,
var xml:XML = <Data></Data>;
xml.appendChild(<ChildData></ ChildData>);
After executing these lines of code, I found that my xml have no ChildData tag. Then I have to use insertChildBefore method as an alternate i.e.
xml.insertChildBefore(null, <ChildData></ ChildData>);
It worked for me. But I want to know the exact reason behind this unknown behaviour of appendChild method. It's not happening everything. Somewhere it works and somewhere it doesn't.
May be it's a compiler issue or something else.
--
Thanks & Regards,
[cid:image001.gif@01CE36A5.8FBDD6D0]Devesh Mishra | Sr. Software Engineer
Mastek Ltd. | NA P&C Division | Mobile: +91-8097032750
Phone: 022-67914646 (5222)


MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~