Writing XPATH Queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajayvaram
    New Member
    • Dec 2007
    • 14

    Writing XPATH Queries

    Hi all,
    Im facing to write some XPATHs,
    My XML file as like as bellow..
    <Plan...>
    .....
    - <InvestmentAcco unt Id="InvestmentA ccount01" Type="Post97Non PR"
    InvestmentStrat egyId="Investme ntStrategy01">
    - <Contribution Id=0 Source="Employe e"
    EscalationBasis ="FixedCompound Pct"
    EscalationPct=" 0.0" Frequency="12" ExistingOrNew=" Existing"
    NextDueDate="20 04-09-15"
    ParameterOverri deIds="Paramete rOverride01">
    - <ContributionLa yer Id=0 StartDate="2002-01-15"
    FMCStartDate="2 002-01-15">
    <ContributionEl ement Amount="150" PremsPaidToDate ="28"
    Status="InForce " />
    <Investment FundName="66E RWP" FundValue="1200 0" />
    </ContributionLay er>
    </Contribution>
    </InvestmentAccou nt>
    - <InvestmentAcco unt Id="InvestmentA ccount02" Type="Post97Non PR"
    InvestmentStrat egyId="Investme ntStrategy02">
    - <Contribution Id=1 Source="Employe r"
    EscalationBasis ="FixedCompound Cop"
    EscalationPct=" 0.0" Frequency="13" ExistingOrNew=" Existing"
    NextDueDate="20 04-09-15"
    ParameterOverri deIds="Paramete rOverride01">
    - <ContributionLa yer Id=1 StartDate="2002-01-15"
    FMCStartDate="2 002-01-15">
    <ContributionEl ement Amount="150" PremsPaidToDate ="28"
    Status="InForce " />
    <Investment FundName="66E RWP" FundValue="1200 0" />
    </ContributionLay er>
    </Contribution>
    </InvestmentAccou nt>
    <InvestmentAcco unt Id="InvestmentA ccount02" Type="VhvbggNon PC"
    InvestmentStrat egyId="Investme ntStrategy03">
    - <Contribution Id=2 Source="Employe r"
    EscalationBasis ="FixedCompound Cop"
    EscalationPct=" 0.0" Frequency="13" ExistingOrNew=" Existing"
    NextDueDate="20 04-09-15"
    ParameterOverri deIds="Paramete rOverride01">
    - <ContributionLa yer Id=2 StartDate="2002-01-15"
    FMCStartDate="2 002-01-15">
    <ContributionEl ement Amount="150" PremsPaidToDate ="28"
    Status="InForce " />
    <Investment FundName="66E RWP" FundValue="1200 0" />
    </ContributionLay er>
    </Contribution>
    </InvestmentAccou nt>
    ......
    </plan>

    Plz check the xml file carefully,
    because Same named Elements are repeted more than 2 times( In my xml it posible more than 2 also)

    1) Here i need XPath Query To find "InvestmentAcco unt.Id" for follwing condition

    InvestmentAccou nt.Id Where InvestmentAccou nt.Type="Post97 NonPR" and Contribution.So urce= "Employer "

    2) To find ContributionLay er.StartDate for following condition

    ContributionLay er.StartDate where Contribution.Id =ContributionLa yer.Id and
    ContributionLay er.FMCStartDate ="2002-01-15" and
    Contribution.Ne xtDueDate="2004-09-15"

    Here ContributionLay er & Contribution are Same level Elements under
    InvestmentAccou nt Node

    Plz Send me XPath Query

    ....Ajay
Working...