[reportlab-users] query! urgent

Robin Becker reportlab-users@reportlab.com
Thu, 2 Jan 2003 16:23:00 +0000


In article <F0CB3C9983B77E4AB4ADEFA63DAB109F0630C6D2@twrmsg03.ad.infosys
.com>, Shaktinath Pandey <Shaktinath_Pandey@infosys.com> writes
>
>I am using pyRXP parser in python,which parses the xml file and puts it
>in the form of Tuple Tree.
>
>for e.g 
> The xml file is like 
>
><PRODUCT>
>    <G1>
>        <P2></P2>
>        <G3>
>            <P3></P3>
>            <P4></P4>
>            <G5>
>                <G6></G6>
>                <G7></G7>
>            </G5>
>        </G3>
>        <G4></G4>
>    </G1>
>    <G2></G2>
>    <P1></P1>
></PRODUCT>
>
>The pyRXP parser will parse and put in the following format
>
>('PRODUCT', None, ['\t\n\t', ('G1', None, ['\n\t\t', ('P2', None, [],
>None), '\n\t\t', ('G3', None, ['\n\t\t\t', ('P3', None,
>[], None), '\n\t\t\t', ('P4', None, [], None), '\n\t\t\t', ('G5', None,
>['\n\t\t\t\t', ('G6', None, [], None), '\n\t\t\t\t', (
>'G7', None, [], None), '\n\t\t\t'], None), '\n\t\t'], None), '\n\t\t',
>('G4', None, [], None), '\n\t'], None), '\n\t', ('G2',
>None, [], None), '\n\t', ('P1', None, [], None), '\n'], None)
>
>
>Now I want to directly hit 'P2' from the above Tuple Tree
>i.e I don't want to traverse through the entire tree and reach to 'P2' i
>want 'P2' element directly.
>How can I achieve this what are the commands for that.
>
P=pyRXP.Parser()
P(txt)[2][1][2][1][0]

will get you what you want. This is dangerous because the spaces tabs
etc are required.

>regards!
>
>Shakti Nath Pandey
>Banking Bussiness Unit
>Infosys Technologies Ltd,
>Banglore
>_______________________________________________
>reportlab-users mailing list
>reportlab-users@reportlab.com
>http://two.pairlist.net/mailman/listinfo/reportlab-users

-- 
Robin Becker