Importing XML into Lotus

Hello,

I have an XML file as shown below:
<?xml version="1.0" encoding="iso-8859-1" ?>

MILON

ODILE

6 RUE FREDERIC MISTRAL

<code_postal>83250</code_postal>

LA LONDE LES MAURES

00494159681

milon_odile@yahoo.fr

Fenêtres

Portes d’Entrée

Volets

Bois

PVC

Aluminium

<offre_financement>Non

</offre_financement>

demande de devis pour changer 2 fenêtres et peut-être l’encadrement bâti dans 2 chambres.

I am creating the Microsoft.XMLDOM object as follows:

Set source = CreateObject(“Microsoft.XMLDOM”)

source.async = False

'Sets the validateOnParse property to false

'source.validateOnParse =False

'This line loads the XML into the parser.

source.load(sourceFile)

This function below is retrieving the elements based on the tag.

Function ElementsByTagName(source,Tag As String)As Variant

Dim XMLList() As String

Set x=source.getElementsByTagName(Tag)



On Error Goto Erreur

Redim XMLList(1 To x.length)

For i = 1 To x.length

	XMLList(i)=(x.item(i-1).text)

Next

ElementsByTagName=XMLList

Exit Function

Erreur:

XMLList(1)=False

ElementsByTagName=XMLList

End Function

I am encountering a problem when I have to retrieve the elements below:

Fenêtres

Portes d’Entrée

Volets

Since the tag is , I am getting the elements “Fenêtres Portes d’Entrée Volets” together and all the three elements are going into one field. The problem is that “Fenêtres”, “Portes d’Entrée” and “Volets” should go in three different fields.

How can I retrieve the elements separately?

Thxs in advance

Subject: Importing XML into Lotus

Your function ElementsByTagName returns a list. When You want to put each element of the list to different field:

TagList = ElementsByTagName (source, “produit”)

k = 1

Forall v in TagList

Call doc.ReplaceItemValue(“fieldName” + k, v)

k = k + 1

End ForAll

or if You have always three elements of the list and want to put to fields with quite different names:

TagList = ElementsByTagName (source, “produit”)

Call doc.ReplaceItemValue(“fieldNameOne”, TagList(1))

Call doc.ReplaceItemValue(“fieldNameTwo”, TagList(2))

Call doc.ReplaceItemValue(“fieldNameThree”, TagList(3))

or there is a lot of another possibilities.

Konrad

Subject: RE: Importing XML into Lotus

The function ElementsByTagName doesn’t return a list but a string.

For e.g the function returns "“Fenêtres Portes d’Entrée Volets”. I wanted 2 split the string with delimeter " " but “Portes d’Entrée” is one product and if i split it by " " it’ll give me two words.

Is there another possible solution?