Fixing Invalid Definitions
When an application definition file does not pass XSD schema validation, it cannot be used for export operations. AppProfileSafe detects invalid definitions automatically and provides a raw XML editor to fix them.
How Invalid Definitions Are Detected
When the Export window loads the application list, each definition file is validated against the XSD schema (AppProfileSafe.App-v1.0.0.xsd). Definitions that fail validation are displayed differently:
| State | Appearance in Export Window |
|---|---|
| Valid | Checkbox with application name and an (edit) link |
| Invalid | Disabled checkbox with application name and invalid format - edit in red text. The validation error is shown as a tooltip. |
Invalid definitions cannot be selected for export. You must fix them first using the raw XML editor.
Opening the Raw XML Editor
Click the edit link next to an invalid definition in the Export window. The App Definition Editor opens in raw XML mode instead of the normal structured mode.
The raw XML editor shows:
- A red error banner at the top displaying the validation error message
- The full XML content of the definition file in a monospaced text editor (Consolas font)
- A Validate button to check your changes against the schema
- The standard Save and Close buttons
The window title indicates raw mode: "Edit Definition (Raw XML): AppName".
Fixing the XML
Step 1: Identify the Problem
Read the error message in the red banner. Common issues include:
- Missing or incorrect XML namespace (
xmlns="urn:appprofilesafe:app:v1") - Unknown or misspelled element names (e.g.
<RegistryKey>instead of<RegKey>) - Elements in wrong order (Registry must come before Files)
- Empty required elements
- Invalid XML syntax (unclosed tags, encoding issues)
Step 2: Edit the XML
Modify the XML content directly in the text editor. The correct structure is:
<?xml version="1.0" encoding="utf-8"?>
<AppDefinition xmlns="urn:appprofilesafe:app:v1"
EntryName="AppName"
SchemaVersion="1.0.0">
<Registry>
<RegKey>HKCU\Software\...</RegKey>
<RegValue>HKCU\Software\...:ValueName</RegValue>
</Registry>
<Files>
<Folder>%APPDATA%\...</Folder>
<File>%APPDATA%\...\config.ini</File>
</Files>
</AppDefinition>
Step 3: Validate
Click the Validate button. The banner updates to show the result:
- ✓ Validation passed. — The XML is valid. You can now save.
- Error messages — The XML still has issues. Review the error details and continue editing.
Saving
The Save button is only enabled after validation passes. When you save:
- If the definition originally had a schema mismatch (e.g. it was created with an older schema version), you are prompted to enter a new definition name. The original file is preserved for compatibility, and a new file is created with the corrected content.
- If the definition had other validation errors (not a schema mismatch), the file is overwritten in place.
After a successful save, the editor automatically switches from raw XML mode to structured mode. The definition is reloaded and displayed in the normal DataGrid view, confirming that the fix was applied correctly.
Common Fixes
| Problem | Solution |
|---|---|
| Missing namespace | Add xmlns="urn:appprofilesafe:app:v1" to the <AppDefinition> element |
| Wrong element names | Use the correct names: RegKey, RegValue, Folder, File |
Missing <Registry> or <Files> wrapper |
Wrap registry entries in <Registry> and file entries in <Files> |
| Elements in wrong order | Ensure <Registry> appears before <Files> |
| Legacy schema format | Save as a new definition — the original file is kept, and the new file uses the current schema |
See Also
- What Is an Application Definition? — Full XML structure reference
- Creating & Editing Definitions (GUI) — Using the structured editor
- XML Schema Reference — All XSD schemas used by AppProfileSafe