1. Karen Bailey
  2. PowerBuilder
  3. Friday, 1 March 2019 14:25 PM

I am running into an odd problem with PBDom when parsing XML using PB2017 Classic on Windows10.  I am getting an error calling BuildFromString to parse my XML.   The error is 'Error calling method of a PBNI object'.

 

I am only receiving this error with the following steps:

1) Open a specific unrelated window in the application (batch authorization window)

2) Immediately close the Batch Authorization window.

3) Open my window using PBDom (Blast hole window).

4) Parsing is fine, Close the Blast Hole window.

6) Open the Batch Authorization window a second time.  Immediately close.

7) Open the Blast Hole window.  Exception parsing XML - 'Error calling method of a PBNI object'.

 

I have the pbdom170.pbd added to my library list.  I am running into this problem in the development environment.  I haven't tried deploying the application yet.  

'C:\Program Files (x86)\Appeon\Shared\PowerBuilder' has been added to my system path. 

 

Question 1: What could be causing the exception error i am receiving only after opening one specific window?

Question 2: Why would this exception only occur after the second open?

 

I have searched for this issue online but all of the examples refer to a deployed environment and missing files.

 

Below is the snippet of code throwing the exception:

try
     idom_pbdom_doc = idom_pbdom_builder.BuildFromString(ls_xml)

catch (throwable e1)
     ls_exception = e1.getmessage()

     //KEB - Error importing xml
     Parent.SetRedraw(True)
     This.SetRedraw(True)

     return
end try

 

Any help on this issue would be great as i have hit a wall.

 

Thanks,

Karen

Karen Bailey Accepted Answer Pending Moderation
  1. Monday, 4 March 2019 13:27 PM
  2. PowerBuilder
  3. # 1
0
Votes
Undo

Hi Olan,

ls_xml is valid. It contains the same data the first time the window is opened and runs without error. It contains the contents of a couple tables in the database and doesn't change between the first and second open of the window.

Below is the contents of my xml:

 

 

idom_pbdom_doc is defined as an instance variable of type pbdom_document. Below is the declaration:

pbdom_document idom_pbdom_doc
pbdom_builder idom_pbdom_builder

 

I don't cast the return value from the BuildFromString call as i use it to parse the document in another function further down where i am expecting a value of type pbdom_object.

 

I can debug but i can't step into the BuildFromString call as it is a pbd.  Below is the quick watch for the exception caught from the BuildFromString call:

Thanks for your help,


Karen

Comment
Solution: click on your pb library and select "Import PB Extensions". Then navigate to your pbdom170.pbx file and select it. You may have to create a new library with the newly imported objects and then copy your new pbdom17 objects over your pre-existing older pbdom objects. Execute a Full Build for good measure.
  1. Allen Hogan
  2. Friday, 23 August 2019 15:09 PM
They don't need to do that. Just add the PBDOM170.dll to your PB App's library list. Remove any old PBNI DOM objects. Then in PB2019, replace the 170 PBD with the 190 PBD. No muss, no fuss -uch easier to maintain & migrate.
  1. Chris Pollach @Appeon
  2. Friday, 23 August 2019 17:17 PM
Unfortunately we were never able to track down the issue and moved away from PBDom instead.



Thanks,



Karen
  1. Karen Bailey
  2. Friday, 23 August 2019 17:32 PM
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 1 March 2019 23:30 PM
  2. PowerBuilder
  3. # 2
0
Votes
Undo

Is the value of LS_XML valid?
I.E.: it's not null, not too long, and contains valid data.

Is "idom_pbdom_doc" a variable of the correct datatype for the return value?
Example:  the return value is a boolean and idom_pbdom_doc is a string.

Do you need to cast the return of the "idom_pbdom_builder.BuildFromString(ls_xml)" call?
Example:  In an OLE call, the return value is ANY so if you want to ssee the return code the entire call needs to be cast:      long   ll_rc
             ll_rc = Long ( ole_object_instance.SomeFunction() )

Is it possible to step into the call using the PB Debugger?


I'm running out of ideas here.

Olan

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Friday, 1 March 2019 15:15 PM
  2. PowerBuilder
  3. # 3
0
Votes
Undo


This is in the nature os an "Is it plugged in?" response, but....

Is the idom_pbdom_builder object valid?

 

IF (NOT (IsNull (idom_pbdom_builder))) THEN

   try
        idom_pbdom_doc = idom_pbdom_builder.BuildFromString(ls_xml)

   catch (throwable e1)
        ls_exception = e1.getmessage()

        //KEB - Error importing xml
        Parent.SetRedraw(True)
        This.SetRedraw(True)

        return
    end try

END IF


Olan

Comment
So my idom_pbdom_builder object is valid. I get passed the isnull check but still throw the exception on the second open of the blast hole window.



Thanks,



Karen
  1. Karen Bailey
  2. Friday, 1 March 2019 15:23 PM
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.