0

I want to comment particular tag with particular value from xml when it is repeating multiple times

example:

<t1>
<t2>hi<t2/>
<t1/>
<t1>
<t2>hello<t2/>
<t1/>
<t1>
<t2>byee<t2/>
<t1/>

I want it as

<t1>
<t2>hi<t2/>
<t1/>
<!--<t1>
<t2>hello<t2/>
<t1/> -->
<t1>
<t2>byee<t2/>
<t1/>
  • I don't understand the example, you've got 3 <t1> containers, and you're commenting out the middle one. You might need to give a more complete example. Also, are you just processing these as text files from the shell? – EightBitTony Jan 15 '16 at 9:04
0

XML is a strict, multiline format, where the nesting of tags carries meaning. You should use a tool able to parse, interpret and recreate it, not snip around with line-oriented tools. Not saying it is easy, far from it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.