Home > OS >  Is there any way to get attribute value in xml, inside nested tag?
Is there any way to get attribute value in xml, inside nested tag?

Time:02-02

Is there any way to get attribute value in xml, inside nested tag? For example:

<xml>
       <sometag name="Charlie">
          <nestedtag>{want to get "Charlie" here}</nestedtag>
       </sometag>
</xml>

CodePudding user response:

You need some XML-aware tool. For example, I'm maintainer of xsh where you can populate the value like this:

open file.xml ;
xcopy /xml/sometag/@name into /xml/sometag/nestedtag/text() ;
save :b ;
  •  Tags:  
  • xml
  • Related