On 11/20/2013 10:21 AM, gajendra s v wrote:
> Hi All,
>
>
> I need to change content of xml ,Please any one suggest me how to
> do,the xml is below
>
>
> <Grading_Automated><PassOrFail>Fail</PassOrFail><ActivityScorebased><AutomatedSequence
> Value="0"/><Percentage>25</Percentage><Value>34</Value><AutomatedSequence
> Value="1"/><Percentage>99</Percentage><Value>432</Value><AutomatedSequence
> Value="2"/><Percentage>43</Percentage><Value>232</Value><AutomatedSequence
> Value="3"/><Percentage>43</Percentage><Value>323</Value><AutomatedSequence
> Value="4"/><Percentage>33</Percentage><Value>432</Value><AutomatedSequence
> Value="5"/><Percentage>45</Percentage><Value>3432</Value></ActivityScorebased></Grading_Automated>
>
> I want xml like below,is there any way
>
> '<Grading_Automated><PassOrFail>*Pass*</PassOrFail><ActivityScorebased><AutomatedSequence
> Value="0"/><Percentage>*40*</Percentage><Value>34</Value><AutomatedSequence
> Value="1"/><Percentage>99</Percentage><Value>432</Value><AutomatedSequence
> Value="2"/><Percentage>43</Percentage><Value>232</Value><AutomatedSequence
> Value="3"/><Percentage>43</Percentage><Value>323</Value><AutomatedSequence
> Value="4"/><Percentage>33</Percentage><Value>432</Value><AutomatedSequence
> Value="5"/><Percentage>45</Percentage><Value>3432</Value></ActivityScorebased></Grading_Automated>
>
If you want all '<PassOrFile>Fail' changed to '<PassOrFail>Pass' you
have straight forward replace, perhaps with a regexp if <PassOrFail> is
elsewhere in xml record. If you need to set specific values for
specific records, your looking at parsing the xml (SAX, DOM, take you
pick) and re-writing the record.