O__XMLdata
Purpose: Saves XML string into a file, reads XML file, and transforms XML string into object. Returns empty XML tree if XML file/string being read is invalid.
Type: Server-side function
Inputs:
- $O__path: The path to the XML, if reading or writing a file. Ignored if $O__flag is set to "1".
- $O__data: The XML string or object.
- $O__flag: "0" for loading XML in the $O__path. "1" for reading XML string provided in $O__data.
Outputs: Only if XML files or strings are being read, returns an XML object.
Use Case: Loading or saving an XML tree. Validating XML without exiting a script.
Examples:
- Load an XML file into a variable: $myXML = O__XMLdata("/path/to/my/file.xml",0,0);
- Save an XML file: O__XMLdata("/path/to/my/file.xml",$myXML,0);
- Load an XML string: $myXML = O__XMLdata(0,$myXML,1);
Version Documented: 20200929