Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to generate an xml file with a small change

 
Srinivas Rallapalli
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
suppose i have an xml file like the following:-
<registers>
<Register name="a1">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF15</Field>
<Bits><Start>15</Start></Bits>
<AccType rowspan = "16">w</AccType>
<Desc rowspan = "16"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF14</Field>
<Bits><Start>14</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF13</Field>
<Bits><Start>13</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF12</Field>
<Bits><Start>12</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF11</Field>
<Bits><Start>11</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF10</Field>
<Bits><Start>10</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF9</Field>
<Bits><Start>9</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF8</Field>
<Bits><Start>8</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
</RD_Row>
</RD_Body>
</RD_Table></Register>

<Register name="a2">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
<AccType>r</AccType>
<Desc><LongName>xx</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
</RD_Body>
</RD_Table></Register>

<Register name="a3">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
<AccType rowspan="2">w</AccType>
<Desc rowspan="2"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
<AccType rowspan="4">r</AccType>
<Desc rowspan="4"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
</RD_Row>
</RD_Body>
</RD_Table></Register>
here there 3 register elements.
in the first register "RD_Row" element it is having an AccType and Desc element with rowspan attribute value 16.
the rest of the "RD_Row" is not having any AccType and Desc elements.
in the second register all RD_Row elements are having AccType and Desc elements.
in the third register some RD_Row elements are having AccType and Desc elements with rowspan attribute. and some RD_Row elements are not having AccType and Desc elements.
here in the first register the rowsapn value is 16. it means AccType and Desc values are common to all remining 15 elements.
in the same way in the 3rd register first RD_Row is having an AccType element with rowspan value 2, now it is common to first 2 RD_Row elements, similarly second one is having 4 as rowspan value. there it is common for 4 elements.
now i want to generate an xml file like the following:-

<registers>
<Register name="a1">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF15</Field>
<Bits><Start>15</Start></Bits>
<AccType rowspan = "16">w</AccType>
<Desc rowspan = "16"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF14</Field>
<Bits><Start>14</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF13</Field>
<Bits><Start>13</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF12</Field>
<Bits><Start>12</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF11</Field>
<Bits><Start>11</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF10</Field>
<Bits><Start>10</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF9</Field>
<Bits><Start>9</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF8</Field>
<Bits><Start>8</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
</RD_Body>
</RD_Table></Register>

<Register name="a2">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
<AccType>r</AccType>
<Desc><LongName>xx</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
</RD_Body>
</RD_Table></Register>

<Register name="a3">
<RD_Table>
<RD_Body>
<RD_Row>
<Field>XF7</Field>
<Bits><Start>7</Start></Bits>
<AccType rowspan="2">w</AccType>
<Desc rowspan="2"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF6</Field>
<Bits><Start>6</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF5</Field>
<Bits><Start>5</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF4</Field>
<Bits><Start>4</Start></Bits>
<AccType>w</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF3</Field>
<Bits><Start>3</Start></Bits>
<AccType rowspan="4">r</AccType>
<Desc rowspan="4"><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF2</Field>
<Bits><Start>2</Start></Bits>
<AccType>r</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF1</Field>
<Bits><Start>1</Start></Bits>
<AccType>r</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
<RD_Row>
<Field>XF0</Field>
<Bits><Start>0</Start></Bits>
<AccType>r</AccType>
<Desc><LongName>???</LongName></Desc>
</RD_Row>
</RD_Body>
</RD_Table></Register>

this means finally i should get an xml file in such a way that all "RD_Row" must contain 4 elements i.e Field,Bits,AccType,Desc

please help me , i am trying since 3 days, but i am not getting. this is very urgent for me. please help me.
thanks,
regards,
srinivas.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic