New SetXMLDeclaration method

In version 2021 or earlier, you can set the XML declaration through the PBDOM_PROCESSINGINSTRUCTION object. For example,

lpbdom_pi.setname('xml')    //This script will cause error in version 2022
lpbdom_pi.setdata ("version=~"1.0~" encoding=~"UTF-16LE~"")
//Set xml declaration
lpbdom_doc.addcontent(lpbdom_pi)

The first line of script in the above example will cause the following error in version 2022, because PBDOM_PROCESSINGINSTRUCTION is no longer supported to add and modify declarations. Exception will occur when the node name of PBDOM_PROCESSINGINSTRUCTION is set to "XML".

An invalid name is used.
Extra Information : 
Function Name : pbdom_processinginstruction::SetName(string strName)
PI Name can't be "xml".

In version 2022, you can set the XML declaration through the new SetXMLDeclaration method.

doc.SetXMLDeclaration ("1.0", "UTF-8", "yes")