Try this one

Set xmlDoc=XMLUtil.CreateXML
xmlDoc.CreateDocument "Environment"
Set xmlRoot=xmlDoc.GetRootElement()

xmlRoot.AddChildElementByName "Variable"," "
Set newNode=xmlRoot.ChildElements().Item(1)

newNode.AddChildElementByName "Name","FirstName"

xmlDoc.SaveFile "C:\Users\Nagesh\Desktop\Firstxml.xml"
Set newNode = Nothing
Set child =Nothing
Set xmlRoot =Nothing
Set xmlDoc =Nothing



On Sat, Jun 2, 2012 at 4:04 PM, sachin mahajan <[email protected]> wrote:

> Hi
>
> i,m creating a xml file by using below mentioned code
> Set xmlDoc=XMLUtil.CreateXML
> xmlDoc.CreateDocument "Environment"
> Set xmlRoot=xmlDoc.GetRootElement()
> Set newNode=xmlRoot.AddChildElementByName("Variable"," ")
> newNode.AddChildElementByName "Name","FirstName"
> newNode.AddChildElementByName "value","Sachin"
>
> Set newNode=xmlRoot.AddChildElementByName("Variable","")
> newnod.AddChildElementByName "Name","LastName"
> newNode.AddChildElementByName "value","dssdf"
>
> xmlDoc.SaveFile "D:\Firstxml.xml"
>
> Set newNode =Nothing
> Set xmlRoot =Nothing
> Set xmlDoc =Nothing
>
> but is it gvg an error
>
> Object required: 'xmlRoot.AddChildElementByName(...)'
>
> Not able to understand wt this error means?
>
> Please verify if i missed anything.
>
>  --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> 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/MercuryQTP?hl=en
>

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
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/MercuryQTP?hl=en

Reply via email to