I have updated materials.dtd and materials.xml so that they (almost) validate together using xmllint which comes with libxml:

xmllint --dtdvalid materials.dtd -noout materials.xml

The only bit that doesn't quite work is the <params> section which is allowed to contain arbitrary element tag names. I have defined its content as type "ANY" but xmllint complains that the tags in it are not known. Is there a way to define the contents of that element as "not to be validated"?

Do people think that provision of DTDs for other parts (or the whole) of the property system is practical and useful? Anybody started?

One important aspect is to make sure they actually get checked. We don't use a validating parser and I don't believe we can easily do so. I propose a Makefile in the base package where "make check" checks the DTDs and anything else that we can automate. The one attached checks the syntax of all the XML files in the base package and validates materials.xml against its DTD. Run it with:

make --keep-going check

to get past the errors ("--" not allowed in comments) in some aircraft files to see the results for the DTD. I fixed one easy instance of the "-- in comment" error in an engine configuration file; patch attached. The others are harder to fix.

- Julian
# Consistency checks for the Flight Gear Base Package

XMLLINT = xmllint -noout

check: check-xml

check-xml: check-xml-syntax check-xml-dtds

check-xml-syntax:
        find . -name '*.xml' | xargs $(XMLLINT)

check-xml-dtds:
        xmllint --dtdvalid materials.dtd -noout materials.xml

.PHONY: check check-xml check-xml-syntax check-xml-dtds

Index: materials.dtd
===================================================================
RCS file: /home/cvsroot/FlightGear/FlightGear/materials.dtd,v
retrieving revision 1.1
diff -u -3 -p -d -r1.1 materials.dtd
--- materials.dtd       2001/12/28 22:37:57     1.1
+++ materials.dtd       2003/01/05 23:10:20
@@ -8,10 +8,15 @@ properties in materials.xml.
 -->
 
 <!ENTITY % colours "r?, g?, b?, a?">
+<!ENTITY % prop-attlist "alias CDATA #IMPLIED">
 
-<!ELEMENT PropertyList (material+)>
+<!ELEMENT PropertyList (params?, material+)>
+<!-- The "params" section contains arbitrary tag names which will be referred
+    to by "alias" attributes. -->
+<!ELEMENT params ANY>
 <!ELEMENT material (name+, texture, wrapu?, wrapv?, mipmap?, xsize?, ysize?,
-                   light-coverage?, ambient?, diffuse?, specular?, emissive?)>
+                   light-coverage?, ambient?, diffuse?, specular?, emissive?,
+                   shininess?, object-group*)>
 <!ELEMENT name (#PCDATA)>
 <!ELEMENT texture (#PCDATA)>
 <!ELEMENT wrapu (#PCDATA)>
@@ -24,6 +29,15 @@ properties in materials.xml.
 <!ELEMENT diffuse (%colours;)>
 <!ELEMENT specular (%colours;)>
 <!ELEMENT emissive (%colours;)>
+<!ELEMENT shininess (#PCDATA)>
+<!ELEMENT object-group (range-m, object+)>
+<!ELEMENT range-m (#PCDATA)>
+<!ATTLIST range-m %prop-attlist;>
+<!ELEMENT object (path+, coverage-m2, heading-type)>
+<!ELEMENT path (#PCDATA)>
+<!ELEMENT coverage-m2 (#PCDATA)>
+<!ATTLIST coverage-m2 %prop-attlist;>
+<!ELEMENT heading-type (#PCDATA)>
 <!ELEMENT r (#PCDATA)>
 <!ELEMENT g (#PCDATA)>
 <!ELEMENT b (#PCDATA)>
Index: materials.xml
===================================================================
RCS file: /home/cvsroot/FlightGear/FlightGear/materials.xml,v
retrieving revision 1.35
diff -u -3 -p -d -r1.35 materials.xml
--- materials.xml       2002/11/26 04:04:32     1.35
+++ materials.xml       2003/01/05 23:10:21
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<!-- <!DOCTYPE PropertyList SYSTEM "materials.dtd"> -->
 
 <!--
 ************************************************************************
@@ -2614,8 +2615,6 @@ Shared parameters for various materials.
  <xsize>500</xsize>
  <ysize>500</ysize>
  <light-coverage>20000000.0</light-coverage>
- <xsize>500</xsize>
- <ysize>500</ysize>
  <ambient>
   <r>0.19</r>
   <g>0.55</g>
Index: Engine/engIO470M.xml
===================================================================
RCS file: /home/cvsroot/FlightGear/FlightGear/Engine/engIO470M.xml,v
retrieving revision 1.1
diff -u -3 -p -d -r1.1 engIO470M.xml
--- Engine/engIO470M.xml        2002/03/07 06:09:21     1.1
+++ Engine/engIO470M.xml        2003/01/05 23:10:32
@@ -10,9 +10,9 @@
   MAXTHROTTLE:   maximum throttle setting (as before)
   MINTHROTTLE:   minimum throttle setting (as before)
 -->
-<!---
+<!--
 From: 
http://www.google.com/search?q=cache:FoqW4cX9V6UC:www.skywagonranch.com/TDS/TCDS/E-273.DOC+Continental+O-470-M+spec&hl=en
---->
+-->
 
 <FG_PISTON NAME="IO470D">
   MINMP             6.5

Reply via email to