Frage

I need to read xml file from local disk using lotus script. I added the code in the script library and called from the notes view.

  origXML = "d:\dxl\xmldom.xml"
  outputFile = "d:\dxl\DOMtree.txt"

  On Error Goto errh

  Set session = New NotesSession    
  Set db = session.CurrentDatabase

  'create the output file
  Set outputStream =session.CreateStream
  outputStream.Open (outputFile)
  outputStream.Truncate

  Set inputStream = session.CreateStream
  inputStream.Open (origXML)

  'create DOM parser and process
  Set domParser=session.CreateDOMParser(inputStream, outputStream)
  domParser.Process

output and input stream , all are getting. But It throws the following error in domParser.Process

Dom parser operation failed

Please help me to solve this. Any help would be appreciated.

War es hilfreich?

Lösung 3

The problem is in the xml header. It was

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" 
    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 
    xmlns:rs="urn:schemas-microsoft-com:rowset" 
    xmlns:z="#RowsetSchema">

I removed all the attributes. I changed to <xml>, and it works.

Andere Tipps

I have the same error. See detail in domParser.log. Maybe incorrect encoding type or not found xsd|xslt stylesheet by url.

Taken from the Designer Help:

Note In Release 7.0, this method was enhanced to handle a DTD located at a URL. However, when using a URL, DOMParser.Process() will intermittently fail raising error #4602:"DOM parser operation failed" if the load on the server is too heavy, resulting in a time-out. If this occurs, the calling application will need to try again.

So it is likely a problem with the dtd, either dtd server isn't responding or responding to slow. I had the same problem and solved it by just trying again if process failed. See code below:

Public Sub ParseString(s As String)
    On Error 4602 GoTo ParserOperationFailed

    Const MAX_RETRIES = 10

    Dim isProcessed As Boolean
    Dim numOfRetries As Integer

    Set domParser = session.Createdomparser(s)

    Do While numOfRetries < MAX_RETRIES And isProcessed = False
        Call domParser.Process()
        isProcessed = true
Retry:
    Loop

    If Not isProcessed Then
        Error 1000, "Unable to get dtd, DOM parser operation failed, tried " + CStr(numOfRetries+1) + "times"
    End If

    Set xmlDoc = domParser.Document

    Set Me.m_rootNode = xmlDoc.Documentelement

    Exit Sub
ParserOperationFailed:
    isProcessed = False
    numOfRetries = numOfRetries + 1
    Resume Retry
End Sub

I ran into the same issue. Instead of just removing the XML header attributes you can do something like the following. InputValidationOption property

'create DOM parser and process
Set domParser = session.CreateDOMParser(inputStream, outputStream)
domParser.InputValidationOption = VALIDATE_NEVER
domParser.Process
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top