diff --git a/PowerEditor/Test/xmlValidator/autoCompletion.xsd b/PowerEditor/Test/xmlValidator/autoCompletion.xsd
new file mode 100644
index 000000000..1969595e9
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/autoCompletion.xsd
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/config.xsd b/PowerEditor/Test/xmlValidator/config.xsd
new file mode 100644
index 000000000..2d4409661
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/config.xsd
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/contextMenu.xsd b/PowerEditor/Test/xmlValidator/contextMenu.xsd
new file mode 100644
index 000000000..d8c1fd198
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/contextMenu.xsd
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/functionList.xsd b/PowerEditor/Test/xmlValidator/functionList.xsd
new file mode 100644
index 000000000..313b190c1
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/functionList.xsd
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/langs.xsd b/PowerEditor/Test/xmlValidator/langs.xsd
new file mode 100644
index 000000000..20893623d
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/langs.xsd
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/nativeLang.xsd b/PowerEditor/Test/xmlValidator/nativeLang.xsd
new file mode 100644
index 000000000..36dc5facd
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/nativeLang.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/shortcuts.xsd b/PowerEditor/Test/xmlValidator/shortcuts.xsd
new file mode 100644
index 000000000..a98ac09f2
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/shortcuts.xsd
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/tabContext.xsd b/PowerEditor/Test/xmlValidator/tabContext.xsd
new file mode 100644
index 000000000..897cf016f
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/tabContext.xsd
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/theme.xsd b/PowerEditor/Test/xmlValidator/theme.xsd
new file mode 100644
index 000000000..f15e9a6ed
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/theme.xsd
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/toolbarButtons.xsd b/PowerEditor/Test/xmlValidator/toolbarButtons.xsd
new file mode 100644
index 000000000..4854535aa
--- /dev/null
+++ b/PowerEditor/Test/xmlValidator/toolbarButtons.xsd
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/Test/xmlValidator/validator_xml.py b/PowerEditor/Test/xmlValidator/validator_xml.py
index 1d6216701..b4615e386 100644
--- a/PowerEditor/Test/xmlValidator/validator_xml.py
+++ b/PowerEditor/Test/xmlValidator/validator_xml.py
@@ -30,15 +30,7 @@ def post_error(message):
pprint(message)
-def parse_xml_file(filename_xml):
-
- # open and read schema file
- #with open(filename_xsd, 'r') as schema_file:
- #schema_to_check = schema_file.read()
-
- # open and read xml file
- #with open(filename_xml, 'r') as xml_file:
- # xml_to_check = xml_file.read()
+def parse_xml_file(filename_xml, filename_xsd = None):
# parse xml
try:
@@ -49,58 +41,128 @@ def parse_xml_file(filename_xml):
except IOError:
#print('Invalid File')
post_error(f'{filename_xml}: IOError Invalid File')
-
+ return
# check for XML syntax errors
except etree.XMLSyntaxError as err:
#print('XML Syntax Error, see error_syntax.log')
post_error(f'{filename_xml}: {str(err.error_log)}: XMLSyntaxError Invalid File')
+ return
# check for general XML errors
except etree.LxmlError as err:
#print('XML Error, see error_syntax.log')
post_error(f'{filename_xml}: {str(err.error_log)}: LxmlError Invalid File')
+ return
+ # unknown error
except:
#print('Unknown error.')
post_error(f'{filename_xml}: Unknown error. Maybe check that no xml version is in the first line.')
+ return
+
+
+
+ # now validate against correct schema
+ if doc and filename_xsd is not None:
+ try:
+ xmlschema_doc = etree.parse(filename_xsd)
+
+ # error reading XSD
+ except IOError:
+ post_error(f'{filename_xml} | {filename_xsd}: IOError Invalid File')
+ return
+
+ # error parsing XSD
+ except etree.XMLSyntaxError as err:
+ post_error(f'{filename_xml} | {filename_xsd}: {str(err.error_log)}: XMLSyntaxError Invalid File')
+ return
+
+ # other error
+ except Exception as err:
+ post_error(f'{filename_xml} | {filename_xsd}: Unknown error {str(err.error_log)} reading Schema .xsd file.')
+ return
+
+ # Next, extract the schema object from the schema_doc
+ try:
+ xmlschema = etree.XMLSchema(xmlschema_doc)
+ #print(f'{filename_xml} | {filename_xsd}: SCHEMA OBJECT OK')
+
+ # error with Schema
+ except etree.XMLSchemaError as err:
+ post_error(f'{filename_xml} | {filename_xsd}: {str(err.error_log)}: XMLSchemaError')
+ return
+
+ # other error
+ except Exception as err:
+ post_error(f'{filename_xml} | {filename_xsd}: Unknown error {str(err.error_log)} obtaining schema object')
+ return
+
+ # finally, validate the XML against the schema
+ if not xmlschema.validate(doc):
+ post_error(f'{filename_xml} | {filename_xsd}: Validation error {str(xmlschema.error_log)}')
+ return
+ else:
+ #print(f'{filename_xml} vs schema: VALIDATION OK')
+ pass
+
def parse_xml_files_from_APIs_dir():
for file in os.listdir("PowerEditor/installer/APIs"):
if file.endswith(".xml"):
#print(os.path.join("PowerEditor/installer/APIs", file))
- parse_xml_file(os.path.join("PowerEditor/installer/APIs", file))
+ parse_xml_file(os.path.join("PowerEditor/installer/APIs", file), os.path.join("PowerEditor", "Test", "xmlValidator", "autoCompletion.xsd"))
def parse_xml_files_from_functionList_dir():
for file in os.listdir("PowerEditor/installer/functionList"):
if file.endswith(".xml"):
#print(os.path.join("PowerEditor/installer/functionList", file))
- parse_xml_file(os.path.join("PowerEditor/installer/functionList", file))
+ xsd_filename = None
+ if not file.endswith("overrideMap.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "functionList.xsd")
+
+ parse_xml_file(os.path.join("PowerEditor/installer/functionList", file), xsd_filename)
def parse_xml_files_from_nativeLang_dir():
for file in os.listdir("PowerEditor/installer/nativeLang"):
if file.endswith(".xml"):
#print(os.path.join("PowerEditor/installer/nativeLang", file))
- parse_xml_file(os.path.join("PowerEditor/installer/nativeLang", file))
+ parse_xml_file(os.path.join("PowerEditor/installer/nativeLang", file), os.path.join("PowerEditor", "Test", "xmlValidator", "nativeLang.xsd"))
def parse_xml_files_from_themes_dir():
for file in os.listdir("PowerEditor/installer/themes"):
if file.endswith(".xml"):
#print(os.path.join("PowerEditor/installer/themes", file))
- parse_xml_file(os.path.join("PowerEditor/installer/themes", file))
+ parse_xml_file(os.path.join("PowerEditor/installer/themes", file), os.path.join("PowerEditor", "Test", "xmlValidator", "theme.xsd"))
+
def parse_xml_files_from_src_dir():
for file in os.listdir("PowerEditor/src"):
if file.endswith(".xml"):
#print(os.path.join("PowerEditor/src", file))
- parse_xml_file(os.path.join("PowerEditor/src", file))
+ xsd_filename = None
+ if file.endswith("stylers.model.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "theme.xsd")
+ elif file.endswith("langs.model.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "langs.xsd")
+ elif file.endswith("toolbarButtonsConf_example.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "toolbarButtons.xsd")
+ elif file.endswith("tabContextMenu_example.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "tabContext.xsd")
+ elif file.endswith("contextMenu.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "contextMenu.xsd")
+ elif file.endswith("shortcuts.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "shortcuts.xsd")
+ elif file.endswith("config.4zipPackage.xml"):
+ xsd_filename = os.path.join("PowerEditor", "Test", "xmlValidator", "config.xsd")
+ parse_xml_file(os.path.join("PowerEditor/src", file), xsd_filename)
-print('Start syntax check for xml files.')
+print('Start syntax check and validation for XML files.')
parse_xml_files_from_APIs_dir()
parse_xml_files_from_functionList_dir()
parse_xml_files_from_nativeLang_dir()
diff --git a/PowerEditor/installer/functionList/javascript.js.xml b/PowerEditor/installer/functionList/javascript.js.xml
index 40b3e23a9..90f05303e 100644
--- a/PowerEditor/installer/functionList/javascript.js.xml
+++ b/PowerEditor/installer/functionList/javascript.js.xml
@@ -24,15 +24,15 @@
- -->
- -->
+
+
+ >
@@ -44,4 +44,4 @@
-
\ No newline at end of file
+
diff --git a/PowerEditor/installer/themes/Bespin.xml b/PowerEditor/installer/themes/Bespin.xml
index 3639f2dc6..eef739ba1 100644
--- a/PowerEditor/installer/themes/Bespin.xml
+++ b/PowerEditor/installer/themes/Bespin.xml
@@ -605,7 +605,6 @@ Credits:
-
@@ -868,8 +867,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/Black board.xml b/PowerEditor/installer/themes/Black board.xml
index 2ae7c022a..f5700d319 100644
--- a/PowerEditor/installer/themes/Black board.xml
+++ b/PowerEditor/installer/themes/Black board.xml
@@ -245,14 +245,6 @@ Credits:
-
-
-
-
-
-
-
-
@@ -611,7 +603,6 @@ Credits:
-
@@ -866,8 +857,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/Choco.xml b/PowerEditor/installer/themes/Choco.xml
index eae236957..015db9808 100644
--- a/PowerEditor/installer/themes/Choco.xml
+++ b/PowerEditor/installer/themes/Choco.xml
@@ -603,7 +603,6 @@ Credits:
-
@@ -858,8 +857,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/DansLeRuSH-Dark.xml b/PowerEditor/installer/themes/DansLeRuSH-Dark.xml
index d018310ef..dfff11665 100644
--- a/PowerEditor/installer/themes/DansLeRuSH-Dark.xml
+++ b/PowerEditor/installer/themes/DansLeRuSH-Dark.xml
@@ -468,13 +468,13 @@ Installation : Copy this file to "%APPDATA%\Notepad++\themes" and in a portable
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -860,7 +860,6 @@ Installation : Copy this file to "%APPDATA%\Notepad++\themes" and in a portable
-
@@ -1100,8 +1099,6 @@ Installation : Copy this file to "%APPDATA%\Notepad++\themes" and in a portable
-
-
diff --git a/PowerEditor/installer/themes/DarkModeDefault.xml b/PowerEditor/installer/themes/DarkModeDefault.xml
index 09ce71e0d..9578dfbdc 100644
--- a/PowerEditor/installer/themes/DarkModeDefault.xml
+++ b/PowerEditor/installer/themes/DarkModeDefault.xml
@@ -653,13 +653,13 @@ License: GPL2
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -1631,7 +1631,7 @@ License: GPL2
-
+
diff --git a/PowerEditor/installer/themes/Deep Black.xml b/PowerEditor/installer/themes/Deep Black.xml
index f5fad2e04..5430d3218 100644
--- a/PowerEditor/installer/themes/Deep Black.xml
+++ b/PowerEditor/installer/themes/Deep Black.xml
@@ -836,8 +836,6 @@ https://notepad-plus-plus.org/donate/
-
-
diff --git a/PowerEditor/installer/themes/Hello Kitty.xml b/PowerEditor/installer/themes/Hello Kitty.xml
index d3e0955f5..4ec633dfb 100644
--- a/PowerEditor/installer/themes/Hello Kitty.xml
+++ b/PowerEditor/installer/themes/Hello Kitty.xml
@@ -958,8 +958,6 @@ so your enhanced file can be included in Notepad++ future release.
-
-
diff --git a/PowerEditor/installer/themes/HotFudgeSundae.xml b/PowerEditor/installer/themes/HotFudgeSundae.xml
index b905f786a..09e2e636e 100644
--- a/PowerEditor/installer/themes/HotFudgeSundae.xml
+++ b/PowerEditor/installer/themes/HotFudgeSundae.xml
@@ -477,13 +477,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -1123,8 +1123,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/Mono Industrial.xml b/PowerEditor/installer/themes/Mono Industrial.xml
index 04364a1ac..e3950f670 100644
--- a/PowerEditor/installer/themes/Mono Industrial.xml
+++ b/PowerEditor/installer/themes/Mono Industrial.xml
@@ -862,8 +862,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/Monokai.xml b/PowerEditor/installer/themes/Monokai.xml
index f801b9df3..fb32f646d 100644
--- a/PowerEditor/installer/themes/Monokai.xml
+++ b/PowerEditor/installer/themes/Monokai.xml
@@ -244,7 +244,7 @@ Credits:
-
+
@@ -862,8 +862,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/MossyLawn.xml b/PowerEditor/installer/themes/MossyLawn.xml
index 4c02ad756..6c012c703 100644
--- a/PowerEditor/installer/themes/MossyLawn.xml
+++ b/PowerEditor/installer/themes/MossyLawn.xml
@@ -478,13 +478,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -774,8 +774,8 @@ Installation:
-
-
+
+
@@ -1123,8 +1123,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/Navajo.xml b/PowerEditor/installer/themes/Navajo.xml
index c48e93663..a140cf013 100644
--- a/PowerEditor/installer/themes/Navajo.xml
+++ b/PowerEditor/installer/themes/Navajo.xml
@@ -475,13 +475,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -1120,8 +1120,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/Obsidian.xml b/PowerEditor/installer/themes/Obsidian.xml
index cb3777442..24bfd11af 100644
--- a/PowerEditor/installer/themes/Obsidian.xml
+++ b/PowerEditor/installer/themes/Obsidian.xml
@@ -623,7 +623,6 @@ Notepad++ Custom Style
-
@@ -777,7 +776,7 @@ Notepad++ Custom Style
-
+
@@ -973,8 +972,6 @@ Notepad++ Custom Style
-
-
diff --git a/PowerEditor/installer/themes/Plastic Code Wrap.xml b/PowerEditor/installer/themes/Plastic Code Wrap.xml
index 9bea31bed..a080da417 100644
--- a/PowerEditor/installer/themes/Plastic Code Wrap.xml
+++ b/PowerEditor/installer/themes/Plastic Code Wrap.xml
@@ -874,8 +874,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/Ruby Blue.xml b/PowerEditor/installer/themes/Ruby Blue.xml
index f27a1f219..733c6c059 100644
--- a/PowerEditor/installer/themes/Ruby Blue.xml
+++ b/PowerEditor/installer/themes/Ruby Blue.xml
@@ -853,8 +853,6 @@ http://sourceforge.net/donate/index.php?group_id=95717
-
-
diff --git a/PowerEditor/installer/themes/Solarized-light.xml b/PowerEditor/installer/themes/Solarized-light.xml
index 90f7057ff..81fda88b4 100644
--- a/PowerEditor/installer/themes/Solarized-light.xml
+++ b/PowerEditor/installer/themes/Solarized-light.xml
@@ -486,13 +486,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -782,8 +782,8 @@ Installation:
-
-
+
+
@@ -797,7 +797,7 @@ Installation:
-
+
@@ -1131,8 +1131,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/Solarized.xml b/PowerEditor/installer/themes/Solarized.xml
index f82b6ea0a..0c7d5c5f8 100644
--- a/PowerEditor/installer/themes/Solarized.xml
+++ b/PowerEditor/installer/themes/Solarized.xml
@@ -620,13 +620,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -1102,7 +1102,7 @@ Installation:
-
+
@@ -1177,7 +1177,7 @@ Installation:
-
+
@@ -1521,8 +1521,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/Twilight.xml b/PowerEditor/installer/themes/Twilight.xml
index 412fd728c..8e855d8a1 100644
--- a/PowerEditor/installer/themes/Twilight.xml
+++ b/PowerEditor/installer/themes/Twilight.xml
@@ -863,8 +863,6 @@ Credits:
-
-
diff --git a/PowerEditor/installer/themes/Vibrant Ink.xml b/PowerEditor/installer/themes/Vibrant Ink.xml
index 132dc1d3e..5f93fc9e7 100644
--- a/PowerEditor/installer/themes/Vibrant Ink.xml
+++ b/PowerEditor/installer/themes/Vibrant Ink.xml
@@ -579,7 +579,6 @@ http://sourceforge.net/donate/index.php?group_id=95717
-
@@ -834,8 +833,6 @@ http://sourceforge.net/donate/index.php?group_id=95717
-
-
diff --git a/PowerEditor/installer/themes/Zenburn.xml b/PowerEditor/installer/themes/Zenburn.xml
index 411fccc01..ca838607b 100644
--- a/PowerEditor/installer/themes/Zenburn.xml
+++ b/PowerEditor/installer/themes/Zenburn.xml
@@ -633,13 +633,13 @@ License: GPL2
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -692,10 +692,10 @@ License: GPL2
-
-
-
-
+
+
+
+
@@ -1599,7 +1599,7 @@ License: GPL2
-
+
diff --git a/PowerEditor/installer/themes/khaki.xml b/PowerEditor/installer/themes/khaki.xml
index 579a6eee7..afa80464d 100644
--- a/PowerEditor/installer/themes/khaki.xml
+++ b/PowerEditor/installer/themes/khaki.xml
@@ -475,13 +475,13 @@ Installation:
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -771,7 +771,7 @@ Installation:
-
+
@@ -1120,8 +1120,6 @@ Installation:
-
-
diff --git a/PowerEditor/installer/themes/vim Dark Blue.xml b/PowerEditor/installer/themes/vim Dark Blue.xml
index 44a5b4502..eb94bed63 100644
--- a/PowerEditor/installer/themes/vim Dark Blue.xml
+++ b/PowerEditor/installer/themes/vim Dark Blue.xml
@@ -738,7 +738,6 @@
-
@@ -949,8 +948,6 @@
-
-