Imports an order from an XML string.

The format looks like this (a full object export). The only required fields are in the oData and aRows() members - the rest is just overflow object state that is not used in any way:

<?xml version="1.0"?>
<wwstore>
	<invoice type="object" class="cwwinvoice">
		<cappstartpath></cappstartpath>
		<ciddatapath></ciddatapath>
		<cpkfield>PK</cpkfield>
		<cserverurl></cserverurl>
		<cshipcountry>US</cshipcountry>
		<cshippingbehaviorclass>cwwShippingBehavior</cshippingbehaviorclass>
		<cshipstate></cshipstate>
		<cskipfieldsforupdates></cskipfieldsforupdates>
		<ctaxbehaviorclass>cwwTaxBehavior</ctaxbehaviorclass>
		<lcompareupdates>0</lcompareupdates>
		<lnoshippingtotal>0</lnoshippingtotal>
		<lnotaxtotal>0</lnotaxtotal>
		<lvalidateonsave>0</lvalidateonsave>
		<nlineitemsmode>0</nlineitemsmode>
		<nsubtotal>399</nsubtotal>
		<ocustomer type="object" class="ccustomer">
			<cappstartpath></cappstartpath>
			<ciddatapath></ciddatapath>
			<cpkfield>PK</cpkfield>
			<cserverurl></cserverurl>
			<cskipfieldsforupdates></cskipfieldsforupdates>
			<lcompareupdates>0</lcompareupdates>
			<lvalidateonsave>0</lvalidateonsave>
			<odata type="object" class="empty">
				<address>32 Kaiea Place</address>
				<city>Paia</city>
				<company>West Wind Technologies</company>
				<country>United States</country>
				<countryid>US</countryid>
				<custtype>0</custtype>
				<downloaded>0</downloaded>
				<email>rstrahl@west-wind.com</email>
				<entered>1999-11-19</entered>
				<fax></fax>
				<firstname>Rick</firstname>
				<foreign></foreign>
				<lastname>Strahl</lastname>
				<lastorder></lastorder>
				<notes></notes>
				<password>windwater</password>
				<phone>(808) 579-8342</phone>
				<pk>1000</pk>
				<referral>West Wind Technologies Web Site</referral>
				<shipping></shipping>
				<source>WCGIVEAWAY_01012000
</source>
				<state>CA</state>
				<storepk>0</storepk>
				<updated>2003-05-29</updated>
				<userid>SA70S8G67</userid>
				<xml></xml>
				<zip>96779</zip>
				<zip4></zip4>
			</odata>
			<ohttpsql>NULL</ohttpsql>
			<oorigdata>NULL</oorigdata>
		</ocustomer>
		<odata type="object" class="empty">
			<cc>4123 1234 1231 1231</cc>
			<ccexp>01/2005</ccexp>
			<ccresult></ccresult>
			<ccresultx></ccresultx>
			<cctype>VI</cctype>
			<completed></completed>
			<custpk>1000</custpk>
			<downloaded>1</downloaded>
			<handling>0</handling>
			<invcode></invcode>
			<invdate>2003-05-27</invdate>
			<invno>0YO1CRZEE83</invno>
			<invtotal>399</invtotal>
			<notes></notes>
			<ordercode></ordercode>
			<pk>169224</pk>
			<ponumber></ponumber>
			<shipby></shipby>
			<shipdisks>0</shipdisks>
			<shipping></shipping>
			<soldby></soldby>
			<storepk>0</storepk>
			<tax>0</tax>
			<taxrate>0</taxrate>
			<weight>0</weight>
			<xml></xml>
		</odata>
		<ohttpsql>NULL</ohttpsql>
		<olineitems type="object" class="clineitems">
			<arows>
				<arows_item type="object" class="empty">
					<custpk>0</custpk>
					<descript>West Wind Web Connection 4.35</descript>
					<discount>0</discount>
					<extratext></extratext>
					<invpk>169224</invpk>
					<itempk>0</itempk>
					<itemtotal>399</itemtotal>
					<pk>171771</pk>
					<price>399</price>
					<qty>1</qty>
					<sku>WCONNECT</sku>
					<storepk>0</storepk>
					<type></type>
					<weight>0</weight>
					<xml></xml>
				</arows_item>
			</arows>
			<cappstartpath></cappstartpath>
			<ciddatapath></ciddatapath>
			<cpkfield>PK</cpkfield>
			<cserverurl></cserverurl>
			<cskipfieldsforupdates></cskipfieldsforupdates>
			<lcompareupdates>0</lcompareupdates>
			<lvalidateonsave>0</lvalidateonsave>
			<ncount>1</ncount>
			<odata>NULL</odata>
			<ohttpsql>NULL</ohttpsql>
			<oorigdata>NULL</oorigdata>
		</olineitems>
		<oorigdata>NULL</oorigdata>
	</invoice>
</wwstore>

Syntax:

o.importxml(lcXML)
Parameters: lcXML
XML string that is to be parsed.
Example:
DO LOAD_WWSTORE

*** Create XML output by loading invoice
*** and exporting to XML
loInv = CREATE("cInvoice")
loInv.Load(     100346)
loInv.ConvertData(6,"wwstore","invoice")  && XML
lcXML = loInv.cResultXML
loInv = .NULL.

*** Create new invoice
oInv = CREATE("cInvoice")
oInv.Load(0)  && Initialize invoice as totally blank
IF !oInv.ImportXML(lcXML)
   ? oInv.cErrorMsg
   RETURN
ENDIF

*** Show that we loaded everything
? oInv.oCustomer.oData.LastName
? oInv.oCustomer.oData.Company
? oInv.oData.InvTotal
? oInv.oLineItems.aRows[1].Descript

See also:

Class cinvoice

Updated: 06/01/03 | Send topic feedback