From: vkr2010 rangavajhala on
how do i edit the xml file so that it uses the value of r?
idea is to be able to make this a function with a stack of xml files for which a childnode in all the files has to be changed with new value of r


r=25;
xDoc = xmlread(fullfile('sample2.xml'))
allListItems = xDoc.getElementsByTagName('region');
qtssao=allListItems.getLength;
thisListItem=allListItems.item(qtssao-1)
childNode = thisListItem.getFirstChild.getData;
thisListItem.getFirstChild.setData('25');
xmlwrite('sample2.xml',xDoc);

thanks in advance,
vkr
From: Donn Shull on
"vkr2010 rangavajhala" <vamsee(a)sjm.com> wrote in message <i255ik$k87$1(a)fred.mathworks.com>...
> how do i edit the xml file so that it uses the value of r?
> idea is to be able to make this a function with a stack of xml files for which a childnode in all the files has to be changed with new value of r
>
>
> r=25;
> xDoc = xmlread(fullfile('sample2.xml'))
> allListItems = xDoc.getElementsByTagName('region');
> qtssao=allListItems.getLength;
> thisListItem=allListItems.item(qtssao-1)
> childNode = thisListItem.getFirstChild.getData;
> thisListItem.getFirstChild.setData('25');
> xmlwrite('sample2.xml',xDoc);
>
> thanks in advance,
> vkr


thisListItem.getFirstChild.setData(num2str(r));
From: vkr2010 rangavajhala on
"Donn Shull" <donn.shull.no_spam(a)aetoolbox.com> wrote in message <i264tr$8lc$1(a)fred.mathworks.com>...
> "vkr2010 rangavajhala" <vamsee(a)sjm.com> wrote in message <i255ik$k87$1(a)fred.mathworks.com>...
> > how do i edit the xml file so that it uses the value of r?
> > idea is to be able to make this a function with a stack of xml files for which a childnode in all the files has to be changed with new value of r
> >
> >
> > r=25;
> > xDoc = xmlread(fullfile('sample2.xml'))
> > allListItems = xDoc.getElementsByTagName('region');
> > qtssao=allListItems.getLength;
> > thisListItem=allListItems.item(qtssao-1)
> > childNode = thisListItem.getFirstChild.getData;
> > thisListItem.getFirstChild.setData('25');
> > xmlwrite('sample2.xml',xDoc);
> >
> > thanks in advance,
> > vkr
>
>
> thisListItem.getFirstChild.setData(num2str(r));


Thanks a ton!!!!