From f65ac65e30ba0d55f0dfc1f00de54c9d968ec982 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Sat, 16 Jan 2016 17:03:00 +0100 Subject: [PATCH] Updated component defaults files to match component schema and made schema validation strict. --- resources/Schema/Components/AABB.xml | 5 ++-- resources/Schema/Components/Camera.xml | 5 ++-- resources/Schema/Components/Collidable.xml | 5 ++-- resources/Schema/Components/Health.xml | 5 ++-- resources/Schema/Components/Listener.xml | 5 ++-- resources/Schema/Components/Model.xml | 5 ++-- resources/Schema/Components/Physics.xml | 5 ++-- resources/Schema/Components/Player.xml | 5 ++-- resources/Schema/Components/PlayerSpawn.xml | 5 ++-- resources/Schema/Components/PointLight.xml | 5 ++-- resources/Schema/Components/PointLight.xsd | 9 +++++- resources/Schema/Components/RaptorCopter.xml | 5 ++-- resources/Schema/Components/SoundEmitter.xml | 5 ++-- resources/Schema/Components/SoundEmitter.xsd | 30 ++++++++++++-------- resources/Schema/Components/SpawnPoint.xml | 3 +- resources/Schema/Components/Spawner.xml | 5 ++-- resources/Schema/Components/Transform.xml | 5 ++-- resources/Schema/Components/Trigger.xml | 5 ++-- resources/Schema/Types/Entity.xsd | 1 + src/Engine/Core/EntityFile.cpp | 2 ++ src/Engine/Core/EntityFilePreprocessor.cpp | 4 +++ 21 files changed, 79 insertions(+), 45 deletions(-) diff --git a/resources/Schema/Components/AABB.xml b/resources/Schema/Components/AABB.xml index 6996b3dc..9c909ea1 100644 --- a/resources/Schema/Components/AABB.xml +++ b/resources/Schema/Components/AABB.xml @@ -1,4 +1,5 @@ - + + - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Camera.xml b/resources/Schema/Components/Camera.xml index 4f613ded..ccb12f01 100644 --- a/resources/Schema/Components/Camera.xml +++ b/resources/Schema/Components/Camera.xml @@ -1,6 +1,7 @@ - + + cam 45 0.01 5000 - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Collidable.xml b/resources/Schema/Components/Collidable.xml index 4f9c9033..9046ea99 100644 --- a/resources/Schema/Components/Collidable.xml +++ b/resources/Schema/Components/Collidable.xml @@ -1,2 +1,3 @@ - - \ No newline at end of file + + + \ No newline at end of file diff --git a/resources/Schema/Components/Health.xml b/resources/Schema/Components/Health.xml index 143a91d1..f53217b9 100644 --- a/resources/Schema/Components/Health.xml +++ b/resources/Schema/Components/Health.xml @@ -1,4 +1,5 @@ - + + 100 100 - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Listener.xml b/resources/Schema/Components/Listener.xml index 7d1fac13..d7e20f92 100644 --- a/resources/Schema/Components/Listener.xml +++ b/resources/Schema/Components/Listener.xml @@ -1,3 +1,2 @@ - - - \ No newline at end of file + + \ No newline at end of file diff --git a/resources/Schema/Components/Model.xml b/resources/Schema/Components/Model.xml index bd20147f..8f78b9ee 100644 --- a/resources/Schema/Components/Model.xml +++ b/resources/Schema/Components/Model.xml @@ -1,5 +1,6 @@ - + + true - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Physics.xml b/resources/Schema/Components/Physics.xml index 1ad81de0..7dce027c 100644 --- a/resources/Schema/Components/Physics.xml +++ b/resources/Schema/Components/Physics.xml @@ -1,3 +1,4 @@ - + + - + diff --git a/resources/Schema/Components/Player.xml b/resources/Schema/Components/Player.xml index 190f2ed0..caefd6e6 100644 --- a/resources/Schema/Components/Player.xml +++ b/resources/Schema/Components/Player.xml @@ -1,7 +1,8 @@ - + + false false false false - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/PlayerSpawn.xml b/resources/Schema/Components/PlayerSpawn.xml index 2082822e..1c621ef9 100644 --- a/resources/Schema/Components/PlayerSpawn.xml +++ b/resources/Schema/Components/PlayerSpawn.xml @@ -1,3 +1,4 @@ - + + 1 - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/PointLight.xml b/resources/Schema/Components/PointLight.xml index 6b1382db..814d7f4c 100644 --- a/resources/Schema/Components/PointLight.xml +++ b/resources/Schema/Components/PointLight.xml @@ -1,7 +1,8 @@ - + + 1.0 0.8 0.3 true - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/PointLight.xsd b/resources/Schema/Components/PointLight.xsd index 039e7117..9b802d8c 100644 --- a/resources/Schema/Components/PointLight.xsd +++ b/resources/Schema/Components/PointLight.xsd @@ -12,7 +12,14 @@ - + + + + + + + + diff --git a/resources/Schema/Components/RaptorCopter.xml b/resources/Schema/Components/RaptorCopter.xml index cc1ece52..1dec4a44 100644 --- a/resources/Schema/Components/RaptorCopter.xml +++ b/resources/Schema/Components/RaptorCopter.xml @@ -1,4 +1,5 @@ - + + 0 - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/SoundEmitter.xml b/resources/Schema/Components/SoundEmitter.xml index 11093e37..e0a38d2f 100644 --- a/resources/Schema/Components/SoundEmitter.xml +++ b/resources/Schema/Components/SoundEmitter.xml @@ -1,4 +1,5 @@ - + + 1.0 1.0 @@ -6,4 +7,4 @@ 20.0 1.0 1.0 - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/SoundEmitter.xsd b/resources/Schema/Components/SoundEmitter.xsd index c734e6ba..9a73949b 100644 --- a/resources/Schema/Components/SoundEmitter.xsd +++ b/resources/Schema/Components/SoundEmitter.xsd @@ -7,18 +7,24 @@ - - The "volume" of the emitter. A value betweeen 0-1 - - The pitch of the emitter. A value betweeen 0-1 - - If the sound should loop or not. - - The distance where there will no longer be any attenuation. - - The rolloff rate of the source. - - The distance that the source will be the loudest. + + The "volume" of the emitter. A value betweeen 0-1 + + + The pitch of the emitter. A value betweeen 0-1 + + + If the sound should loop or not. + + + The distance where there will no longer be any attenuation. + + + The rolloff rate of the source. + + + The distance that the source will be the loudest. + diff --git a/resources/Schema/Components/SpawnPoint.xml b/resources/Schema/Components/SpawnPoint.xml index 3f392555..6b2f7ae3 100644 --- a/resources/Schema/Components/SpawnPoint.xml +++ b/resources/Schema/Components/SpawnPoint.xml @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/resources/Schema/Components/Spawner.xml b/resources/Schema/Components/Spawner.xml index f2ac77a8..da659c69 100644 --- a/resources/Schema/Components/Spawner.xml +++ b/resources/Schema/Components/Spawner.xml @@ -1,3 +1,4 @@ - + + - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Transform.xml b/resources/Schema/Components/Transform.xml index 00202aa4..7e2bcd83 100644 --- a/resources/Schema/Components/Transform.xml +++ b/resources/Schema/Components/Transform.xml @@ -1,5 +1,6 @@ - + + - \ No newline at end of file + \ No newline at end of file diff --git a/resources/Schema/Components/Trigger.xml b/resources/Schema/Components/Trigger.xml index 4c8aad58..38c6fce9 100644 --- a/resources/Schema/Components/Trigger.xml +++ b/resources/Schema/Components/Trigger.xml @@ -1,2 +1,3 @@ - - \ No newline at end of file + + + \ No newline at end of file diff --git a/resources/Schema/Types/Entity.xsd b/resources/Schema/Types/Entity.xsd index f64bae3b..8fc52e1e 100644 --- a/resources/Schema/Types/Entity.xsd +++ b/resources/Schema/Types/Entity.xsd @@ -16,6 +16,7 @@ + diff --git a/src/Engine/Core/EntityFile.cpp b/src/Engine/Core/EntityFile.cpp index 1e381df5..5589eddf 100644 --- a/src/Engine/Core/EntityFile.cpp +++ b/src/Engine/Core/EntityFile.cpp @@ -23,6 +23,8 @@ void EntityFile::Parse(const EntityFileHandler* handler) const EntityFileSAXHandler saxHandler(handler, nullptr); m_SAX2XMLReader->setFeature(XMLUni::fgXercesCacheGrammarFromParse, true); m_SAX2XMLReader->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true); + m_SAX2XMLReader->setFeature(XMLUni::fgXercesSchema, true); + m_SAX2XMLReader->setFeature(XMLUni::fgXercesSchemaFullChecking, true); m_SAX2XMLReader->setContentHandler(&saxHandler); m_SAX2XMLReader->setErrorHandler(&saxHandler); m_SAX2XMLReader->setDeclarationHandler(&saxHandler); diff --git a/src/Engine/Core/EntityFilePreprocessor.cpp b/src/Engine/Core/EntityFilePreprocessor.cpp index 4b720976..f9aae3d4 100644 --- a/src/Engine/Core/EntityFilePreprocessor.cpp +++ b/src/Engine/Core/EntityFilePreprocessor.cpp @@ -174,7 +174,11 @@ void EntityFilePreprocessor::parseDefaults() memset(ci.second.Defaults.get(), 0, ci.second.Meta.Stride); XercesDOMParser parser(nullptr, XMLPlatformUtils::fgMemoryManager); + parser.setDoSchema(true); + parser.setDoNamespaces(true); parser.setErrorHandler(&errorHandler); + parser.setValidationScheme(XercesDOMParser::Val_Always); + parser.setValidationSchemaFullChecking(true); std::string componentName = ci.first; LOG_DEBUG("Parsing defaults for component %s", componentName.c_str());