another try...
I just made a simple new project with one object containing simple Getfileselect and Calling fu_file_read_xml(ps_filename)
In library list only included pbdom220.pbd
Same problem "PBNI_Exception": "Error calling method of a PBNI object". In IDE it runs without problems.
You can download and install this via https://tw8.thermis.de/TESTXML
There is a sample XML "Heiko 2017.XML" included.
What is wrong?
Best regards
Stephan
Code of fu_file_read_xml(ps_filename) as follows
PBDOM_Builder lpbdom_Builder
PBDOM_Document lpbdom_Doc
PBDOM_Object lpbdom_Obj[]
PBDOM_Element lpbdom_Element
PBDOM_Attribute lpbdom_Attribute
integer li_Counter, li_Max, li_count
string ls_Text, ls_parseErrors[], ls_name, ls_objectclass
string ls_version, ls_encoding, ls_standalone
long ll_ret
long ll_objectclass
boolean lb_parse
boolean lb_state
ll_ret = XMLParseFile(ps_filename) // adds .log add end
IF ll_ret = 0 THEN
TRY
lpbdom_Builder = CREATE PBDOM_BUILDER
// Import File and generate XML
lpbdom_Doc = lpbdom_Builder.BuildFromFile( ps_filename )
lb_parse = lpbdom_Builder.GetParseErrors(ls_parseErrors)
IF lb_parse THEN
FOR li_count = 1 TO Upperbound(ls_parseErrors)
MessageBox("ParseError",ls_parseErrors[li_count])
NEXT
END IF
IF isValid (lpbdom_Doc) THEN
lpbdom_Doc.getxmldeclaration (ls_version, ls_encoding, ls_standalone)
IF lpbdom_Doc.HasChildren() THEN
IF lpbdom_Doc.GetContent( lpbdom_Obj ) THEN
// Get 1st Level data
li_Max = UpperBound( lpbdom_Obj )
FOR li_count = 1 TO li_max
ls_objectclass = lpbdom_Obj[li_count].GetObjectClassString()
ll_objectclass = lpbdom_Obj[li_count].GetObjectClass()
IF ll_objectclass = TPBDOM_ELEMENT THEN
ls_name = lpbdom_Obj[li_count].GetName()
ls_Text = lpbdom_Obj[li_count].GetText()
lpbdom_Element = lpbdom_Obj[li_count]
IF ls_name = "Road" THEN
IF lpbdom_Element.HasAttributes() THEN
lpbdom_Attribute = lpbdom_Element.getAttribute("Version")
is_xml_version = lpbdom_Attribute.GetText()
ii_road_version = integer(is_xml_version)
MessageBox("Success","Version = " + string(ii_road_version))
END IF
// fu_parse_road(lpbdom_Element,ps_filename)
END IF
END IF
NEXT
END IF
END IF
END IF
CATCH (PBDOM_Exception lpbdom_Except)
MessageBox( "PBDOM_Exception", lpbdom_Except.GetMessage())
CATCH (PBXRuntimeError re)
MessageBox( "PBNI_Exception", re.GetMessage())
END TRY
DESTROY lpbdom_Builder
lb_state = TRUE
ELSE
lb_state = FALSE
END IF
RETURN lb_state
Well, this is documented here https://docs.appeon.com/pb2022/application_techniques/PowerBuilder_extensions.html. But I always thought that PBXerces.dll and xerces-c.dll are required to support xml in datawindows.
Andreas.
The xerces dll's were not necessary in PB 2019
Andreas.