Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to parse an XML file in VFP6
Message
De
21/03/2006 05:03:03
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01105029
Message ID:
01106137
Vues:
20
>Hi Cetin
>
>>You can use MSXML.DOMDocument to load and parse an XML:
>>oXDOM = Createobject("MSXML.DOMDocument")
>
>I just found a FAQ but no serious doc was found for using the instantiated object of MSXML.DOMDocument. Any details that you may have, could you kindly provide.

Bhavbhuti,
It has a big object model, mostly collection based. ie: This is partial code from one of my reader classes (an HTML is just another XML):
* ...
		loDocument = loForm.htmlviewer.Object.Document
		loTables = loDocument.getElementsByTagName('TABLE')
		lcCodes = ''
		For ix = 0 To loTables.Length-1
			lcCodes = m.lcCodes + Chr(13)+Chr(10)+;
				this.ReadTemplates(loTables.Item(m.ix), loTables.Item(m.ix).Id)
		Endfor
		Return m.lcCodes
	Endproc

	Procedure ReadTemplates(toTable, m.tcProcName)
		Local lcCode, loRows, loRow, iRows, iCells, oAttr, loCells, ix,jx,loCaption
		Set Textmerge To Memvar m.lcCode Noshow
		Set Textmerge On
		loRows = toTable.getElementsByTagName('TR')
		If loRows.Length > 0
	\
	\procedure <<m.tcProcName>>
	\lparameters toDocument, toBody, oRow
			For iRows = 0 To loRows.Length-1
				loRow = loRows.Item(m.iRows)
	\local loRow,loCell
	\loRow = toDocument.createElement('TR')
				oAttr = loRow.Attributes
				For ix = 0 To oAttr.Length-1
					If oAttr.Item(m.ix).specified
			\loRow.<<oAttr.item(m.ix).name>> = "<<oAttr.item(m.ix).nodeValue>>"
					Endif
				Endfor
				loCells = loRow.getElementsByTagName('TD')
*...
What it does is to read template HTML fragments and create code that would transform actual data into HTML dynamically on the fly (reads and writes the 'writer'). IOW VFP style XSLT (I could never feel comfortable with XSL transformation languages).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform