SaveXMLSchema
You can use the SaveXMLSchema function to write an XSD (XML Schema Definition) file that describes the structure of XML used by the current Optiva object. The function is designed for multi-object XML files generated by WebReports.
Unlike ObjectXSD, the SaveXMLSchema function reads a WebReport XML file, identifies WebReport-specific XSD nodes under /fsxml/report/SchemaList/Schema, and consolidates them into a single XSD file.
Note: The
SaveXMLSchema function is supported for unsecured scripting only.
When to use
You can use this function to:
- Generate or validate the XSD schema for a WebReport XML file containing multiple objects.
- Generate a schema file for WebReports that reflects the combined structure of all included objects.
- Export XSD schema definitions programmatically from unsecured scripting for downstream processing or validation tools.
- Document or inspect the schema of a specific XML export produced by WebReports.
When not to use
You cannot use this function:
- In secured scripting mode. Calling this function in secured mode throws a permission violation.
- As a replacement for
ObjectXSDwhen you need the schema for a single object. - When the target XML file does not follow the WebReport XML structure and does not contain
/fsxml/report/SchemaList/Schemanodes. The output can be incomplete or invalid.
Syntax
int SaveXMLSchema(string xmlFile, string outFile);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| xmlFile | string | Yes | The full path to the WebReport XML file that will be read to generate the schema.
Note: This file must follow the WebReport XML structure containing XSD nodes under /fsxml/report/SchemaList/Schema.
|
| outFile | string | Yes | The full path (including filename) where the generated XSD schema file will be saved.
Note: The function writes the consolidated XSD content to this location.
|
Return Value
The application returns a value zero (0) if the XSD schema file is generated and saved successfully.
Impact
This function does not modify application state, database records, or any existing files beyond writing the specified output XSD file.
Prerequisites
- The
SaveXMLSchemafunction is supported only in unsecured scripting mode. - The function cannot be called from secured mode.
SaveXMLSchema vs ObjectXSD
| Feature | SaveXMLSchema | ObjectXSD |
|---|---|---|
| Purpose | Multi-object WebReport XML | Single object XML |
| Input | XML file path | Object symbol/key |
| Output | Saves XSD to file | Returns XSD as string |
| XML Source | WebReport XML files | Object XML |
| XSD Nodes | /fsxml/report/SchemaList/Schema |
Generated from object structure |
| Use Case | WebReport schema generation | Single object schema |
| Security | Unsecured mode only | Works in secured mode |