In version 2021 or earlier, you can get the XML declaration through the PBDOM_DOCUMENT GetContent method. The GetContent method gets a pbdom_object array, and the PBDOM_PROCESSINGINSTRUCTION object included in the array contains the XML declaration. For example:
doc.getcontent(lpd_object[]) //Gets all nodes of the xml file For i = 1 To UpperBound(lpd_object) //Gets the PBDOM_PROCESSINGINSTRUCTION object ls_objtype = lpd_object[i].getobjectclassstring() if ls_objtype =pbdom_processinginstruction then ls_key = lpd_object[i].getname() ls_value = lpd_object[i].gettext() end if next
In version 2022, you can get the XML declaration through the new GetXMLDeclaration method.
String version, encoding, standalone doc.getxmldeclaration (version, encoding, standalone)