Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Modifying XML with VBA [Thread Next] Re: Modifying XML with VBATo: NULL Date: 2/27/2009 5:40:00 AM Thank you Martin, that fixed my problem.
On Jan 22, 10:07=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> matturnwrote:
> > =A0 =A0 'Find and select all the Placemarks using the #trb248 style
> > =A0 =A0 Set oxmlNodes =3D oxmlDoc.SelectNodes("//Placemark
> > [styleUrl=3D'#trb248']")
>
> > =A0 =A0 'Change the selected styles
> > =A0 =A0 For Each oxmlNode In oxmlNodes
> > =A0 =A0 =A0 =A0 Set oxmlNameNode =3D oxmlNode.SelectSingleNode("//name"=
)
>
> I think you want
> =A0 =A0 =A0 =A0 =A0 =A0Set oxmlNameNode =3D oxmlNode.selectSingleNode("na=
me")
> here as that selects the first "name" child element of oxmlNode while
> using "//name" would select the first "name" descendant element of the
> root node of the complete XML document.
>
> > =A0 =A0 =A0 =A0 strName =3D Replace(Mid(oxmlNameNode.XML, 7, Len
> > (oxmlNameNode.XML) - 13), " ", "")
> > =A0 =A0 =A0 =A0 Set oxmlStyleNode =3D oxmlNode.SelectSingleNode("//styl=
eUrl")
>
> And here you probably want
> =A0 =A0 =A0 =A0 =A0 =A0Set oxmlStyleNode =3D oxmlNode.SelectSingleNode("s=
tyleUrl")
> again to select the first "styleUrl" child element of oxmlNode.
>
> --
>
> =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML
> =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
