Results 1 to 2 of 2

Thread: xml reading data help

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2012
    Posts
    7

    xml reading data help

    Hello friends,


    I have a huge xml file and need to read data if some conditions are true, a kind of regex. I tried a lot with regex but goes fail. I have hosted the xml file over here since its huge

    I need to check some conditions
    Code:
     <PDBx:B_iso_or_equiv>.*</PDBx:B_iso_or_equiv>
             <PDBx:Cartn_x>.*</PDBx:Cartn_x>
             <PDBx:Cartn_y>.*</PDBx:Cartn_y>
             <PDBx:Cartn_z>.*</PDBx:Cartn_z>
             <PDBx:auth_asym_id>.*</PDBx:auth_asym_id>
             <PDBx:auth_atom_id>SG</PDBx:auth_atom_id>
             <PDBx:auth_comp_id>CYS</PDBx:auth_comp_id>
             <PDBx:auth_seq_id>.*</PDBx:auth_seq_id>
             <PDBx:group_PDB>ATOM</PDBx:group_PDB>
    IF "<PDBx:auth_comp_id>" value ="CYS" and "<PDBx:auth_atom_id>" value="SG" then i have to read values of <PDBx:Cartn_x>.*</PDBx:Cartn_x>
    <PDBx:Cartn_y>.*</PDBx:Cartn_y>
    <PDBx:Cartn_z>.*</PDBx:Cartn_z>

    The .* indicates it varies from one to another

    I tried with regex and xml parsing but failed.can someone help me to complete this project .
    Thanks

  2. #2
    Frenzied Member dolot's Avatar
    Join Date
    Nov 2007
    Location
    Music city, U.S.A.
    Posts
    1,253

    Re: xml reading data help

    Instead of using regex, maybe it would help if you used xpath syntax - since it's specifically designed to parse xml nodes

    http://www.w3schools.com/xpath/xpath_syntax.asp
    I always add to the reputation of those whose posts are helpful, and even occasionally to those whose posts aren't helpful but who obviously put forth a valiant effort. That is, when the system will allow it.
    My war with a browser-redirect trojan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width