Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VISUAL BASIC - Trying to find XPATH values?

Options
  • 05-10-2005 12:28pm
    #1
    Registered Users Posts: 5,099 ✭✭✭


    Hi

    I am trying to give a function an XPATH and a DOM object and return a specific value.

    For instance if I do

    GetFormValueFromXMLFile("//QuarterlyInsuranceReturn/St1/InsuranceContract/NumberofPolicies/@TWO", oXMLDoc)
    I should get 2 (xml file is below)


    Any ideas?
    Thanks guys



    Function GetFormValueFromXMLFile(strXMLQuery As String, oXMLDoc As FreeThreadedDOMDocument)

    Dim objNodeList, i
    Dim strText As String

    Text1.Text = Text1.Text & "strXMLQuery Is " & strXMLQuery & vbCrLf
    'Set objNodeList = oXMLDoc.documentElement.selectNodes(strXMLQuery)
    'Set objNodeList = oXMLDoc.documentElement.selectSingleNode(strXMLQuery)

    GetFormValueFromXMLFile = 17 'just to make the code compile

    End Function





    <?xml version="1.0" encoding="UTF-8" ?>
    <QuarterlyInsuranceReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation="\\Server1\XML Schema\QuarterlyInsuranceSchema.xsd">
    <submissionDetails submissionCompany="ADRIATIC" quarter="Quarter 1" submissionYear="2005" />
    <St1>
    <InsuranceContract>
    <NumberofPolicies FIVE="4" FOUR="3" SIX="5" THREE="2" EIGHT="7" TEN="9" SEVEN="6" NINE="8" TWO="1" />
    <NumberofInsured FIVE="40" FOUR="30" SIX="50" THREE="20" EIGHT="70" TEN="90" SEVEN="60" NINE="80" TWO="10" />
    <PremiumWritten FIVE="400" FOUR="300" SIX="500" THREE="200" EIGHT="700" TEN="900" SEVEN="600" NINE="800" TWO="100" />
    </InsuranceContract>
    <Claims>
    <NumberofOneoffClaims FIVE="4000" FOUR="3000" SIX="5000" THREE="2000" EIGHT="7000" TEN="9000" SEVEN="6000" NINE="8000" TWO="1000" />
    <NumberofInstallmentPaymentClaims FIVE="40000" FOUR="30000" SIX="50000" THREE="20000" EIGHT="70000" TEN="90000" SEVEN="60000" NINE="80000" TWO="10000" />
    <GrossClaimsPaidInOneOffAmount FIVE="400000" FOUR="300000" SIX="500000" THREE="200000" EIGHT="700000" TEN="900000" SEVEN="600000" NINE="800000" TWO="100000" />
    <GrossClaimsPaidIstallmentPayments FIVE="4000000" FOUR="3000000" SIX="5000000" THREE="2000000" EIGHT="7000000" TEN="9000000" SEVEN="6000000" NINE="8000000" TWO="1000000" />
    </Claims>
    </St1>
    </QuarterlyInsuranceReturn>


Advertisement