Search Postgresql Archives

Re: How to change content of xml datatype

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux