S
sony.m.2007
Hi,
I need to find an element in the XML file and replace the element with
another element.
I'm planning to use DOM.
Is there any tutorial available for searching an element and replace
using dom
Example xml file
<?xml version="1.0" encoding="utf-8" ?>
<details>
<detail>
<description>name</description>
<t1>10</t1>
<t1>100</t1>
<t1>1000</t1>
</detail>
<detail>
<description>name</description>
<t1>11</t1>
<t1>111</t1>
<t1>11111</t1>
</detail>
<detail>
<description>name</description>
<t1>21</t1>
<t1>221</t1>
<t1>2221</t1>
</detail>
</details>
I need to find where element t1 like this in following order <t1>10</
t1>
<t1>100</t1>
<t1>1000</t1>
Then I need to replace like this <t1>10 or 100 or 1000</t1>
the output like this
<?xml version="1.0" encoding="utf-8" ?>
<details>
<detail>
<description>name</description>
<t1>10 or 100 or 1000</t1>
</detail>
<detail>
<description>name</description>
<t1>11</t1>
<t1>111</t1>
<t1>11111</t1>
</detail>
<detail>
<description>name</description>
<t1>21</t1>
<t1>221</t1>
<t1>2221</t1>
</detail>
</details>
Any help to achieve above output
Thanks,
Sony
I need to find an element in the XML file and replace the element with
another element.
I'm planning to use DOM.
Is there any tutorial available for searching an element and replace
using dom
Example xml file
<?xml version="1.0" encoding="utf-8" ?>
<details>
<detail>
<description>name</description>
<t1>10</t1>
<t1>100</t1>
<t1>1000</t1>
</detail>
<detail>
<description>name</description>
<t1>11</t1>
<t1>111</t1>
<t1>11111</t1>
</detail>
<detail>
<description>name</description>
<t1>21</t1>
<t1>221</t1>
<t1>2221</t1>
</detail>
</details>
I need to find where element t1 like this in following order <t1>10</
t1>
<t1>100</t1>
<t1>1000</t1>
Then I need to replace like this <t1>10 or 100 or 1000</t1>
the output like this
<?xml version="1.0" encoding="utf-8" ?>
<details>
<detail>
<description>name</description>
<t1>10 or 100 or 1000</t1>
</detail>
<detail>
<description>name</description>
<t1>11</t1>
<t1>111</t1>
<t1>11111</t1>
</detail>
<detail>
<description>name</description>
<t1>21</t1>
<t1>221</t1>
<t1>2221</t1>
</detail>
</details>
Any help to achieve above output
Thanks,
Sony