0

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.

4

4 回答 4

1

我有同样的错误。详见domParser.log. 可能不正确的编码类型或未通过 url 找到 xsd|xslt 样式表。

于 2013-12-09T12:34:48.240 回答
0

我遇到了同样的问题。除了删除 XML 标头属性之外,您还可以执行以下操作。 InputValidationOption 属性

'create DOM parser and process
Set domParser = session.CreateDOMParser(inputStream, outputStream)
domParser.InputValidationOption = VALIDATE_NEVER
domParser.Process
于 2014-03-12T20:36:35.257 回答
0

问题出在 xml 标头中。它是

<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">

我删除了所有属性。我更改为<xml>,并且可以正常工作。

于 2013-12-10T16:24:10.210 回答
0

取自设计器帮助:

注意 在 7.0 版中,此方法已得到增强,可以处理位于 URL 的 DTD。但是,当使用 URL 时,如果服务器上的负载过重,DOMParser.Process() 将间歇性地失败并引发错误 #4602:"DOM parser operation failed",从而导致超时。如果发生这种情况,调用应用程序将需要重试。

所以很可能是dtd的问题,要么dtd服务器没有响应,要么响应慢。我遇到了同样的问题,如果进程失败,只需重试即可解决。请参见下面的代码:

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
于 2013-04-25T13:47:19.523 回答