Updated component defaults files to match component schema and made schema validation strict.

This commit is contained in:
2016-01-16 17:03:00 +01:00
parent b2213dbe9a
commit f65ac65e30
21 changed files with 79 additions and 45 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
<c:AABB>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<AABB xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="AABB.xsd">
<Origin X="0" Y="0" Z="0"/>
<Size X="1" Y="1" Z="1"/>
</c:AABB>
</AABB>
+3 -2
View File
@@ -1,6 +1,7 @@
<c:Camera>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Camera xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Camera.xsd">
<Name>cam</Name>
<FOV>45</FOV>
<NearClip>0.01</NearClip>
<FarClip>5000</FarClip>
</c:Camera>
</Camera>
+3 -2
View File
@@ -1,2 +1,3 @@
<c:Collidable>
</c:Collidable>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Collidable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Collidable.xsd">
</Collidable>
+3 -2
View File
@@ -1,4 +1,5 @@
<c:Health>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Health xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Health.xsd">
<Health>100</Health>
<MaxHealth>100</MaxHealth>
</c:Health>
</Health>
+2 -3
View File
@@ -1,3 +1,2 @@
<c:Listener>
</c:Listener>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Listener xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Listener.xsd"/>
+3 -2
View File
@@ -1,5 +1,6 @@
<c:Model>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Model.xsd">
<Resource></Resource>
<Color R="1" G="1" B="1" A="1"/>
<Visible>true</Visible>
</c:Model>
</Model>
+3 -2
View File
@@ -1,3 +1,4 @@
<c:Physics>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Physics xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Physics.xsd">
<Velocity X="0" Y="0" Z="0"/>
</c:Physics>
</Physics>
+3 -2
View File
@@ -1,7 +1,8 @@
<c:Player>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Player xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Player.xsd">
<Velocity X="0" Y="0" Z="0"/>
<Forward>false</Forward>
<Left>false</Left>
<Back>false</Back>
<Right>false</Right>
</c:Player>
</Player>
+3 -2
View File
@@ -1,3 +1,4 @@
<c:PlayerSpawn>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<PlayerSpawn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PlayerSpawn.xsd">
<TeamID>1</TeamID>
</c:PlayerSpawn>
</PlayerSpawn>
+3 -2
View File
@@ -1,7 +1,8 @@
<c:PointLight>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<PointLight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PointLight.xsd">
<Color R="1" G="1" B="1" A="1"/>
<Radius>1.0</Radius>
<Intensity>0.8</Intensity>
<Falloff>0.3</Falloff>
<Visible>true</Visible>
</c:PointLight>
</PointLight>
+8 -1
View File
@@ -12,7 +12,14 @@
<xs:element name="Color" type="t:Color" minOccurs="0"/>
<xs:element name="Radius" type="t:double" minOccurs="0"/>
<xs:element name="Intensity" type="t:double" minOccurs="0"/>
<xs:element name="Falloff" type="t:double" minOccurs="0" minInclusive="0" maxInclusive="1"/>
<xs:element name="Falloff">
<xs:simpleType>
<xs:restriction base="t:double">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Visible" type="t:bool" minOccurs="0"/>
</xs:all>
</xs:complexType>
+3 -2
View File
@@ -1,4 +1,5 @@
<c:RaptorCopter>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RaptorCopter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="RaptorCopter.xsd">
<Speed>0</Speed>
<Axis X="0" Y="0" Z="0"/>
</c:RaptorCopter>
</RaptorCopter>
+3 -2
View File
@@ -1,4 +1,5 @@
<c:SoundEmitter>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SoundEmitter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SoundEmitter.xsd">
<FilePath></FilePath>
<Gain>1.0</Gain>
<Pitch>1.0</Pitch>
@@ -6,4 +7,4 @@
<MaxDistance>20.0</MaxDistance>
<RollOffFactor>1.0</RollOffFactor>
<ReferenceDistance>1.0</ReferenceDistance>
</c:SoundEmitter>
</SoundEmitter>
+18 -12
View File
@@ -7,18 +7,24 @@
<xs:complexType>
<xs:all>
<xs:element name="FilePath" type="t:string" minOccurs="0"/>
<xs:element name="Gain" type="t:double" minOccurs="0"/>
<xs:annotation><xs:documentation>The "volume" of the emitter. A value betweeen 0-1</xs:documentation></xs:annotation>
<xs:element name="Pitch" type="t:double" minOccurs="0"/>
<xs:annotation><xs:documentation>The pitch of the emitter. A value betweeen 0-1</xs:documentation></xs:annotation>
<xs:element name="Loop" type="t:bool" minOccurs="0"/>
<xs:annotation><xs:documentation>If the sound should loop or not.</xs:documentation></xs:annotation>
<xs:element name="MaxDistance" type="t:double" minOccurs="0"/>
<xs:annotation><xs:documentation>The distance where there will no longer be any attenuation.</xs:documentation></xs:annotation>
<xs:element name="RollOffFactor" type="t:double" minOccurs="0"/>
<xs:annotation><xs:documentation>The rolloff rate of the source.</xs:documentation></xs:annotation>
<xs:element name="ReferenceDistance" type="t:double" minOccurs="0"/>
<xs:annotation><xs:documentation>The distance that the source will be the loudest.</xs:documentation></xs:annotation>
<xs:element name="Gain" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The "volume" of the emitter. A value betweeen 0-1</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Pitch" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The pitch of the emitter. A value betweeen 0-1</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="Loop" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>If the sound should loop or not.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="MaxDistance" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The distance where there will no longer be any attenuation.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="RollOffFactor" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The rolloff rate of the source.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="ReferenceDistance" type="t:double" minOccurs="0">
<xs:annotation><xs:documentation>The distance that the source will be the loudest.</xs:documentation></xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
+2 -1
View File
@@ -1 +1,2 @@
<c:SpawnPoint/>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SpawnPoint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SpawnPoint.xsd"/>
+3 -2
View File
@@ -1,3 +1,4 @@
<c:Spawner>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Spawner xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Spawner.xsd">
<EntityFile></EntityFile>
</c:Spawner>
</Spawner>
+3 -2
View File
@@ -1,5 +1,6 @@
<c:Transform>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Transform xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Transform.xsd">
<Position X="0" Y="0" Z="0"/>
<Orientation X="0" Y="0" Z="0"/>
<Scale X="1" Y="1" Z="1"/>
</c:Transform>
</Transform>
+3 -2
View File
@@ -1,2 +1,3 @@
<c:Trigger>
</c:Trigger>
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Trigger xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Trigger.xsd">
</Trigger>
+1
View File
@@ -16,6 +16,7 @@
<xs:element ref="c:Test" minOccurs="0"/>
<xs:element ref="c:RaptorCopter" minOccurs="0"/>
<xs:element ref="c:Player" minOccurs="0"/>
<xs:element ref="c:Camera" minOccurs="0"/>
<xs:element ref="c:AABB" minOccurs="0"/>
<xs:element ref="c:Trigger" minOccurs="0"/>
<xs:element ref="c:Health" minOccurs="0"/>
+2
View File
@@ -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);
@@ -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());