Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Access a tag value directly impossible >Thread Next - Re: Access a tag value directly impossible Re: Access a tag value directly impossibleTo: NULL Date: 7/2/2004 9:46:00 AM Thank you that was a good ide! Now i have another trick question! Can XPath be used to update an Atribute or Element value? Have tried some and also read some place that Dom+Xpath together could be read-only. "Joe Fawcett" <joefawcett@h...> wrote in message news:<e84FPhqXEHA.3716@T...>... > "shoe" <hassehb@y...> wrote in message > news:f0e1779.0406300524.43b89e6a@p...... > > Terrible simple question i think but I'm to tired mocking around now > > for 2 days with this problem ! > > Using parser java "Dom" I want to change one "name" tag value ONLY in > > this XML (below). Notice that there are many "name" tags. > > > > I can search trough this xml using a Dom parser but that will give me > > a list of all name tags - using this syntax: > > doc.getElementsByTagName("name"); > > > > how do I directly access and change the deepest "name" tag: > > projectDescription/buildSpec/buildCommand/name ?????? > > > > I have tríed this: (does not work)! > > > doc.getElementsByTagName("projectDescription/buildSpec/buildCommand/name"); > > to get a lock on that tag and then simply change the value. > > > > There are a risk that I access the wrong tag if i cant specify full > > path! > > > > > If possible with your parser use XPath to select the nodes, > "projectDescription/buildSpec/buildCommand/name", rather than > getElementsByTagName. > > > Joe (MVP - xml) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
