This works:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function show():void{
var xList:XMLList = inputData.descendants().(@taskId == "1");
var newXml:String = "<Task taskId='1.50' startDate='Sat Oct 25 18:39:49
GMT+0530 2008' endDate='Sat Oct 25 18:39:49 GMT+0530 2008' effort='1
hr'resources='Anand' relation='Predecessor ' deliverable='No
'taskDescription='one' relatedTask='none' group='p0001' />";
xList.appendChild(newXml);
Alert.show(inputData.toXMLString());
}
]]>
</mx:Script>
<mx:XML id="inputData">
<Project>
<Task taskId="1" startDate="Sat Oct 25 18:39:49 GMT+0530
2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0001" />
<Task taskId="2" startDate="Sat Oct 25 18:39:49 GMT+0530
2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="2 hrs"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0001" />
<Task taskId="3" startDate="Sat Oct 25 18:39:49 GMT+0530
2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="3 hrs"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0001" />
<Task taskId="4" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0002" />
<Task taskId="5" startDate="Sat Oct 25 18:39:49 GMT+0530
2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="2 hrs"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0002" />
<Task taskId="6" startDate="Sat Oct 25 18:39:49 GMT+0530
2008"
endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="3 hrs"
resources="Anand" relation="Predecessor " deliverable="No "
taskDescription="one" relatedTask="none" group="p0003" />
</Project>
</mx:XML>
<mx:Button click="show()" width="100"/>
</mx:Application>
On Mon, Nov 17, 2008 at 7:17 PM, sheetal nilwant
<[EMAIL PROTECTED]>wrote:
> here it is:-
> <mx:XML id="inputData">
> <Project>
> <Task taskId="1" startDate="Sat Oct 25 18:39:49 GMT+0530
> 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0001" />
>
> <Task taskId="2" startDate="Sat Oct 25 18:39:49 GMT+0530
> 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="2 hrs"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0001" />
>
> <Task taskId="3" startDate="Sat Oct 25 18:39:49 GMT+0530
> 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="3 hrs"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0001" />
>
> <Task taskId="4" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0002" />
>
> <Task taskId="5" startDate="Sat Oct 25 18:39:49 GMT+0530
> 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="2 hrs"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0002" />
>
> <Task taskId="6" startDate="Sat Oct 25 18:39:49 GMT+0530
> 2008"
> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="3 hrs"
> resources="Anand" relation="Predecessor " deliverable="No "
> taskDescription="one" relatedTask="none" group="p0003" />
> </Project>
> </mx:XML>
>
>
>
> On Mon, Nov 17, 2008 at 6:38 PM, Vinod M. Jacob <[EMAIL PROTECTED]>wrote:
>
>> Would you please paste the XML in the correct format with opening and
>> closing of each tag.
>>
>>
>> On Mon, Nov 17, 2008 at 5:04 PM, sheetal nilwant <
>> [EMAIL PROTECTED]> wrote:
>>
>>> I am not able to do that.The node which has a group is not able to add a
>>> child to itself.And neways,append does not work for a node having zero
>>> children.It needs atleast one child.
>>> Basically i am displaying this flat struc. XML in ADG in a hierarchial
>>> form.And what i want to do is add a child at any selected node.
>>> There is one property of GroupCollection-canHaveChild(Boolean).I have
>>> checked with it and it shows the node belonging to some group in the XML
>>> cant have child(this boolean returns 'false').I want to know if there is
>>> something else i can do,keeping the XML flat struc.
>>>
>>>
>>> On Mon, Nov 17, 2008 at 1:27 PM, Vinod M. Jacob <[EMAIL PROTECTED]>wrote:
>>>
>>>> Just get the node where you want to add the new node into an
>>>> XMLListcollection and append the new node to this XMLListcollection.......
>>>>
>>>>
>>>> On Sun, Nov 16, 2008 at 7:45 PM, sheetal <[EMAIL PROTECTED]>wrote:
>>>>
>>>>>
>>>>> I am not able to add child to the element which is a group member
>>>>> already.That means i am adding a level 3 child.
>>>>>
>>>>> [Project]
>>>>> [Task taskId="1" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
>>>>> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
>>>>> resources="Anand" relation="Predecessor " deliverable="No "
>>>>> taskDescription="one" relatedTask="none" group="p0001"]
>>>>> [Task taskId="2" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
>>>>> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="2 hrs"
>>>>> resources="Anand" relation="Predecessor " deliverable="No "
>>>>> taskDescription="one" relatedTask="none" group="p0001"]
>>>>> [Task taskId="3" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
>>>>> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="3 hrs"
>>>>> resources="Anand" relation="Predecessor " deliverable="No "
>>>>> taskDescription="one" relatedTask="none" group="p0001"]
>>>>>
>>>>> [Task taskId="4" startDate="Sat Oct 25 18:39:49 GMT+0530 2008"
>>>>> endDate="Sat Oct 25 18:39:49 GMT+0530 2008" effort="1 hr"
>>>>> resources="Anand" relation="Predecessor " deliverable="No "
>>>>> taskDescription="one" relatedTask="none" group="p0002"]
>>>>>
>>>>> [Project]
>>>>> This is my XML and i want to add child to the existing child for
>>>>> ex.element with taskId '1'.This will be at 3rd level.
>>>>> Can ne one help me with it...
>>>>>
>>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---