Strange error importing xml

I am trying for the first time to import an xml file into a domino database using the NotesDOMParser class. When I import the following code I get a type mismatch error when instantiating the first NotesDOMElementNode variable.

<?xml version="1.0" encoding="UTF-8" ?>

585738

460-120-0034

<Header_headerNum>R5531415</Header_headerNum>

120 mm

Even more strangely, when importing the code below it works fine.

<?xml version="1.0" encoding="UTF-8" ?>

585738460-120-0034<Header_headerNum>R5531415</Header_header

Num>120 mm

The only difference between the two snippets of XML code is that I have inserted line breaks into the first snippet (i.e. the failing one) to make it more readable. As you can see, the second snippet looks messy and if anything, this is what you would expect to fail!

Can anyone see the problem with the first snippet of xml? I would really appreciate some help here as this problem is holding up the roll-out of a project.

Thanks in advance,

Eoin.

Subject: strange error importing xml

It would help if you posted your LS code. I haven’t done much with NotesDOMParser. Have you tried running the code directly from the help file (the “walkTree” agent) to see if that causes any errors? If it runs correctly, then the error is probably in your LS code somewhere, regardless of whether it seems like the XML that’s causing the problem.

Subject: RE: strange error importing xml

Thanks for your response!

I am not familiar with the ‘walkTree’ agent. I will search Designer Help to see if I can find out about it.

My code is as follows:

Sub Initialize

Dim s As New NotesSession

Set db=s.CurrentDatabase

Dim InputPath As String

InputPath=|c:\wheel.xml|

Dim ST As NotesStream

Set ST=s.CreateStream

Dim domP As NotesDOMParser

Set domP=s.CreateDOMParser(ST)

On Event PostDOMParse From domP Call PostDOMParse

domP.Process

End Sub

Sub PostDOMParse(Source As NotesDOMParser)

Dim entryList As NotesDOMNodeList

Dim CurrentEntry As NotesDOMNode

Dim CurrentElement As NotesDOMElementNode

Dim root As NotesDOMDocumentNode

Set root=Source.Document

Set entrylist=root.GetElementsByTagName(|label|)

For i=1 To entrylist.NumberOfEntries

Set doc=New NotesDocument(db)

doc.Form=“wheel”

Set CurrentEntry=entrylist.GetItem(i)

'BELOW IS THE LINE THAT GIVES TYPE MISMATCH

Set CurrentElement=CurrentEntry.FirstChild

doc.orderNum=CurrentElement.FirstChild.NodeValue

Set CurrentElement=CurrentElement.NextSibling

doc.itemNum=CurrentElement.FirstChild.NodeValue

Set CurrentElement=CurrentElement.NextSibling

doc.woNum=CurrentElement.FirstChild.NodeValue

Set CurrentElement=CurrentElement.NextSibling

doc.description=CurrentElement.FirstChild.NodeValue

doc.save True, False

Next

End Sub

The code seems fine because it imports the second snippet of XML that I posted. It seems that the above script with import the xml when I put all xml onto one line! Any ideas?

Thanks in advance,

Eoin.