Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

The Below mentioned content is my XML Document.

HTML
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">

    <w:body>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading1" />
                    </w:ppr>
                    <w:r>
                          <w:t>Para1</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading2" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para2</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading3" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para3</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading4" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para4</w:t>
                     </w:r>
             </w:p>

            <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading1" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para5</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading3" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para6</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading4" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para7</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading2" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para8</w:t>
                     </w:r>
             </w:p>

             <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading3" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para9</w:t>
                     </w:r>
             </w:p>

            <w:p>
                   <w:ppr>
                          <w:pstyle w:val="Heading1" />
                   </w:ppr>
                    <w:r>
                          <w:t>Para10</w:t>
                     </w:r>
             </w:p>

    </w:body>

</w:document>


So, While reading each <w:p xmlns:w="#unknown">, i want to check its w:pPr -> w:pStyle attribute value w:val.For example, in the above file,the first w:p contains that(w:pPr->w:pStyle) attribute value as "Heading1". So, For the first w:p>, i don't care about anything and just take it.After, taken this w:p,

Logic 1 :i want to split the attribute value Heading1 for retrieving strings after the Heading. So,Now we get 1.

Afterwards, the While reading next w:p,Apply the same Logic 1 for spiting the current attribute value.So,in this case, we have 2. Now, i want to compare this current value 2 with previous value 1.

Logic 2 : If it is less than the previous value then only select the current w:p,otherwise,don't do anything.

Apply the above Logic 1 and Logic 2 for all of the w:p nodes.

So,In my case, I want to select, only the following w:p nodes.

Required Selection is :


Para1
Para5
Para8
Para10

Hope u understood my problem...

What i do for this situation?...

Please Guide me to get out of this issue...

Thanks & Regards,
P.SARAVANAN
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900