ict-torquilclark
asked on
Argument 'Start' must be greater than zero.
I am using the following code in some VB.Net
XmlSearch = Strings.Mid(strXml, InStr(strXml, "<exweb_varied varied_name=""Term"">"))
getting an error
Argument 'Start' must be greater than zero.
I have copied the text from the strXml into a notepad document and ctr;+f'd <exweb_varied varied_name="Term"> and it finds it.
what am i doing wrong?
XmlSearch = Strings.Mid(strXml, InStr(strXml, "<exweb_varied varied_name=""Term"">"))
getting an error
Argument 'Start' must be greater than zero.
I have copied the text from the strXml into a notepad document and ctr;+f'd <exweb_varied varied_name="Term"> and it finds it.
what am i doing wrong?
Can you post a snippet of the source XML you are using?
ASKER
t><amount currency="GBP">0.13</amoun t></paymen t></commis sion_entit lement><tp sdata><exw eb_varied varied_name="Sum Assured"><original_value>5 0000</orig inal_value ><new_valu e>50000</n ew_value>< /exweb_var ied><exweb _varied varied_name="Term"><origin al_value>1 5</origina l_value><n ew_value>1 5</new_val ue></exweb _varied></ tpsdata></ client_spe cific_illu stration>< tpsdata><e xchange_fo rmid></exc hange_form id><exchan ge_extrane t_availabl e>False</e xchange_ex tranet_ava ilable><pr int_types_ available> 99</print_ types_avai lable></tp sdata></pr oduct></ap plication> </m_conten t></messag e></transa ction></m_ content></ message>
<message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.origoservices.com"><m_control><contr ol_timesta mp>2010-12 -06T09:16: 33.0253</c ontrol_tim estamp><me ssage_id>3 06f443f-61 e5-4c39-a8 ef-8f3a6c1 5a3df</mes sage_id><r etry_numbe r>0</retry _number><m essage_typ e>Remote Publishing Alert</message_type><messa ge_version >/origo/2. 1/RPAlert. xsd</messa ge_version ><expected _response_ type>none< /expected_ response_t ype><initi ator_id>Ex change, The</initiator_id><initiat or_orchest ration_id> 338763_010 995_91_GL< /initiator _orchestra tion_id><r esponder_i d>LPDirect </responde r_id></m_c ontrol><m_ content><a lert_actio n>Add</ale rt_action> <target_en vironment> Live</targ et_environ ment><tran saction originator_ID="AEGON Scottish Equitable"><message xmlns="http://www.origoservices.com" schemaLocation="http://www.origoservices.com/Schema/3_2/QNBProtectionQuoteResponse.xsd"><m_contr ol><contro l_timestam p>2010-12- 06T09:16:1 9.0000</co ntrol_time stamp><mes sage_id>ce 6710dd-947 1-41c2-ac5 f-
073a093ceac7</message_id>< retry_numb er>0</retr y_number>< message_ty pe>Quotati on Response</message_type><me ssage_vers ion>/origo /3.2/QNBPr otectionQu oteRespons e.xsd</mes sage_versi on><messag e_status>S uccess</me ssage_stat us><respon se_locatio n>TQ-Quote s-Web-Serv ice~B8D30C 30</respon se_locatio n><initiat or_id>LPDi rect</init iator_id>< initiator_ orchestrat ion_id>219 _302176_62 92056</ini tiator_orc hestration _id><user_ id>LPD001 LPD002</user_id><responder _id>Exchan ge, The</responder_id></m_cont rol><m_con tent><b_co ntrol><ser vice_provi der_refere nce_number >338763</s ervice_pro vider_refe rence_numb er><interm ediary_cas e_referenc e_number>0 1012060916 2165</inte rmediary_c ase_refere nce_number ><quote_ty pe>Compari son</quote _type><quo te_or_prin t>Quote Only</quote_or_print><gene ric_quote_ ind>No</ge neric_quot e_ind><mes sage_versi on_number> 3.2</messa ge_version _number><s ubmission_ date>2010- 12-06</sub mission_da te><quote_ response_s tatus>Warn ing</quote _response_ status></b _control>< intermedia ry type="IFA"><sib_number>150 427</sib_n umber><com pany_name> L
ife Policies Direct</company_name><bran ch_name>Li fe Policies Direct</branch_name><agenc y_address> <postcode> WV3 0TZ</postcode></agency_add ress><cont act_detail s><name>LP D001</name ></contact _details>< /intermedi ary><appli cation><pe rsonal_cli ent id="pc1"><title>Mr</title> <forenames >Lewis</fo renames><s urname>Tur ner</surna me><sex>Ma le</sex><d ate_of_bir th>1989-04 -11</date_ of_birth>< tax_rate>2 0</tax_rat e><smoker_ ind>No</sm oker_ind>< preferred_ life_ind>N o</preferr ed_life_in d></person al_client> <product type="Term Protection" product_code="Electronic"> <product_n ame>Term Assurance (e)</product_name><increme nt_ind>No< /increment _ind><bene fits_requi red><life_ assured personal_client_id="pc1" sequence_number="1"></life _assured>< death_ind> Yes</death _ind><deat h_or_earli er_cic_ind >No</death _or_earlie r_cic_ind> <critical_ illness_in d>No</crit ical_illne ss_ind><tp d_ind>No</ tpd_ind><w aiver_ind> No</waiver _ind><unem ployment_i nd>No</une mployment_ ind></bene fits_requi red><quote _details>< reference_ number></r eference_n umber></qu ote_detail s><ris
k_benefit id="rb1" type="Life And Health"><cover_basis>
<message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.origoservices.com"><m_control><contr
073a093ceac7</message_id><
ife Policies Direct</company_name><bran
k_benefit id="rb1" type="Life And Health"><cover_basis>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim n as integer= InStr(strXml, "<exweb_varied varied_name=""Term"">")
If n>0 Then
XmlSearch = Strings.Mid(strXml, n)
Else
MsgBox("Not found!")
End If
If n>0 Then
XmlSearch = Strings.Mid(strXml, n)
Else
MsgBox("Not found!")
End If