A XMLDOM simple sample
Posted: Fri May 23, 2008 3:29 am
Hi,
This is my simple test using XMLDOM:
I have instaled Windows Server 2003 SP2 e .NET 1.0 e 2.0 and SOAP Toolkit 3.0.
A XML table:
PS: Not tested in other Windows versions.
This is my simple test using XMLDOM:
I have instaled Windows Server 2003 SP2 e .NET 1.0 e 2.0 and SOAP Toolkit 3.0.
Code: Select all
#include "FiveWin.ch"
Function main()
local RespText, objXMLHTTP
oXMLDoc := TOLEAUTO():New("Microsoft.XMLDOM")
// Allow the document to complete loading
oXMLDoc:async := .f.
lSuccess := oXMLDoc:load( "books.xml" )
x := oXMLDoc:getElementsByTagName( "book" )
y := oXMLDoc:getElementsByTagName( "author" )
for i = 1 to x:length
agendamentoDetails := x
? agendamentoDetails:Item(i-1):NodeName + " = " + agendamentoDetails:Item(i-1):Text
? y:Item(i-1):Text
next
return nil
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
<book>
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>