Totally new to xml

AndyShuter

Registered User.
Local time
Today, 08:02
Joined
Mar 3, 2003
Messages
151
Whilst on holiday last week I have been reading about the wonders of xml! Following this, one of my clients has forwarded a piece of code that he says is "dead easy" to use!!! erm. Maybe easy for some, but total gobbeldy gook to a layperson like me.

What I would really love to do is understand how to use this to automatically fire data via the web from my database to his

I am assuming that say on line 4 where it says "983", I could substitute this with Me.DealerCode (for exampole?)

Here is the code he has sent me

<?xml version="1.0" ?>
<proposal request_type="NEW_PROPOSAL">
<proposal_type>CONSUMER</proposal_type>
<introducer_ref>983</introducer_ref>
<vendor>ABC Cars Ltd</vendor>
<customer type="MAIN"> <!-- Range MAIN, JOINT -->
<name>
<title>Mr</title> <!-- Range MR, MRS, MISS, MS, DR -->
<first_name>Keith</first_name>
<last_name>Miller</last_name>
</name>
<date_of_birth>
<dd>1</dd>
<mm>1</mm>
<yyyy>1970</yyyy>
</date_of_birth>
<gender>M</gender> <!-- Range M, F -->
<marital_status>married</marital_status> <!-- Range SINGLE, MARRIED, DIVORCED_SEPARATED, WIDOWED, LIVES_WITH_PARTNER -->
<home_phone>
<std>01908</std>
<number>123456</number>
</home_phone>
<work_phone>
<std>01234</std>
<number>456789</number>
</work_phone>
<mobile_phone>
<std>07777</std>
<number>987654</number>
</mobile_phone>
<address type="current"> <!-- Range CURRENT, PREVIOUS -->
<years_at>3</years_at>
<months_at></months_at>
<occupancy_status>owner</occupancy_status> <!-- Range OWNER, FURNISHED_TENANT, UNFURNISHED_TENANT, LIVES_WITH_PARENTS, COUNCIL_TENANT, TENANT -->
<flat></flat>
<house_name></house_name>
<house_number>18</house_number>
<postcode>mk187es</postcode>
<street> </street>
<district></district>
<town></town>
<county></county>
</address>
<employment index="0"> <!-- Range 0,1,2,3, ... -->
<employment_type>E</employment_type> <!-- Range E=Employed, SE=Self Employed, R=Retired, UE=Unemployed, O=Other -->
<employed_from>
<mm>12</mm>
<yyyy>1999</yyyy>
</employed_from>
<occupation>Plumber</occupation>
<company_name>Plumbers Ltd</company_name>
<business_address>1 Plumbing Road</business_address>
<business_postcode>MK11MK</business_postcode>
</employment>
<bank>
<account_name>Mr K Miller</account_name>
<sortcode>601455</sortcode>
<account_no>36528609</account_no>
</bank>
</customer>
<customer type="JOINT"> <!-- Range MAIN, JOINT -->
<name>
<title>Mr</title> <!-- Range MR, MRS, MISS, MS, DR -->
<first_name>Graham</first_name>
<last_name>White</last_name>
</name>
<date_of_birth>
<dd>02</dd>
<mm>01</mm>
<yyyy>1949</yyyy>
</date_of_birth>
<gender>M</gender> <!-- Range M, F -->
<marital_status>MARRIED</marital_status> <!-- Range SINGLE, MARRIED, DIVORCED_SEPARATED, WIDOWED, LIVES_WITH_PARTNER -->
<home_phone>
<std>01908</std>
<number>456789</number>
</home_phone>
<work_phone>
<std>01234</std>
<number>789987</number>
</work_phone>
<mobile_phone>
<std>07777</std>
<number>111222</number>
</mobile_phone>
<address type="CURRENT"> <!-- Range CURRENT, PREVIOUS -->
<years_at>3</years_at>
<months_at></months_at>
<occupancy_status>OWNER</occupancy_status> <!-- Range OWNER, FURNISHED_TENANT, UNFURNISHED_TENANT, LIVES_WITH_PARENTS, COUNCIL_TENANT, TENANT -->
<flat></flat>
<house_name></house_name>
<house_number>8</house_number>
<postcode>MK77EP</postcode>
<street></street>
<district></district>
<town></town>
<county></county>
</address>
<address type="previous"> <!-- Range CURRENT, PREVIOUS -->
<years_at>1</years_at>
<months_at></months_at>
<occupancy_status>FURNISHED_TENANT</occupancy_status> <!-- Range OWNER, FURNISHED_TENANT, UNFURNISHED_TENANT, LIVES_WITH_PARENTS, COUNCIL_TENANT, TENANT -->
<flat></flat>
<house_name></house_name>
<house_number>8</house_number>
<postcode>MK77EP</postcode>
<street></street>
<district></district>
<town></town>
<county></county>
</address>
<employment index="0"> <!-- Range 0,1,2,3, ... -->
<employment_type>E</employment_type> <!-- Range E=Employed, SE=Self Employed, R=Retired, UE=Unemployed, O=Other -->
<employed_from>
<mm>02</mm>
<yyyy>1983</yyyy>
</employed_from>
<occupation>Project Manager</occupation>
<company_name>Transition Computing Ltd</company_name>
<business_address>Suite 12, Challenge House, Bletchley
</business_address>
<business_postcode>MK63DP</business_postcode>
</employment>
</customer>
<vehicle>
<vrm>V843LOX</vrm>
<mileage>5000</mileage>
<type>U</type> <!-- Range N,U -->
<first_reg>UK</first_reg> <!-- Range UK, OVERSEAS -->
<category>CAR</category> <!-- Range CAR, MCYCLE, LCV, OTHER -->
<classic>N</classic> <!-- Range Y, N -->
<make>BMW</make>
<model>3 SERIES (E46) 323CI SE</model>
<body_type>Coupe</body_type>
<transmission>MANUAL 5 GEARS</transmission>
<engine_capacity>2500</engine_capacity>
<colour>BLUE</colour>
<FRUK>
<dd>03</dd>
<mm>11</mm>
<yyyy>1999</yyyy>
</FRUK>
<year_of_manufacture>1999</year_of_manufacture>
<engine_number>26749325</engine_number>
<VIN>WBABM32020EX32433</VIN>
<fuel_type>PETROL</fuel_type>
<ins_grp>15</ins_grp>
<TVMA>9200</TVMA>
<retail>11400</retail>
</vehicle>
<finance>
<cost>5000</cost>
<vat_applicable>N</vat_applicable> <!-- Range Y, N -->
<deposit>500</deposit>
<term>36</term> <!-- Range 12 to 48 -->
<flat_rate>6</flat_rate>
</finance>
</proposal>
 
Have a read of the XML tutorials on W3Schools - if I remember correctly, there's an example which shows this.
 
Read it - still confused!!!

Had a look, he sent me some other code that works great - this sends a text message via a web site

Code:
Me.Refresh
If MsgBox("Are you sure?", vbQuestion + vbYesNo, "Deal Trak") = vbYes Then
Dim xmlstring As String

    Username = Forms!frmIntro.SMSUsername
    Password = Forms!frmIntro.SMSPassword
    Message = "Message from " & "" & Forms!frmIntro.BrokerName & "" & ".Your application has been provisionally approved. Please call our office on " & "" & Forms!frmIntro.BrokerDayTelNo & "" & " for further details"
    Destination = Me.Text150
    xmlstring = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & "?> " & _
   "<Request xmlns:xsi=" & Chr(34) & "http://www.w3.org/2001/XMLSchema-instance" & Chr(34) & " xsi:noNamespaceSchemaLocation=" & Chr(34) & "http://schema.2sms.com/1.0/0410_RequestSendMessage.xsd" & Chr(34) & " Version = " & Chr(34) & "1.0" & Chr(34) & ">" & _
        "<Identification>" & _
            "<UserID><![CDATA[" & Username & "]]></UserID>" & _
            "<Password>" & Password & "</Password>" & _
        "</Identification>" & _
        "<Service>" & _
            "<ServiceName>SendMessage</ServiceName>" & _
            "<ServiceDetail>" & _
                "<SingleMessage>" & _
                    "<Destination>" & Destination & "</Destination>" & _
                    "<Text><![CDATA[" & Message & "]]></Text>" & _
                "</SingleMessage>" & _
            "</ServiceDetail>" & _
        "</Service>" & _
    "</Request>"

    Dim xmlrequest As MSXML2.XMLHTTP
   Set xmlrequest = New MSXML2.XMLHTTP
    xmlrequest.Open "post", "http://web.2sms.com/xml/xml.jsp", False
    xmlrequest.setRequestHeader "content-type", "text/xml"
    xmlrequest.send xmlstring


DoCmd.Close acForm, "frmText"
 
Last edited by a moderator:
Access can export/import XML so you don't need to "code" it.
 

Users who are viewing this thread

Back
Top Bottom