[PATCH] fix fdi DTD and validate fdi's

Artem Kachitchkine Artem.Kachitchkin at Sun.COM
Thu Dec 8 20:25:53 PST 2005


Hi,

I tried to validate fdi files using fdi.dtd and got a whole lot of 
errors. Looks like DTD is out of date. This patch updates the DTD and 
adds fdi validation to 'make check'. I'm not an XML expert, please 
review carefully.

-Artem.

  20freedesktop/Makefile.am             |    3 ++
  90defaultpolicy/Makefile.am           |    4 +++
  fdi.dtd                               |   40 
++++++++++++++++++++++++++++------
  information/10freedesktop/Makefile.am |    4 +--
  policy/10osvendor/Makefile.am         |    3 ++
  preprobe/10osvendor/Makefile.am       |    4 +--
  6 files changed, 48 insertions(+), 10 deletions(-)

-------------- next part --------------
Index: hal/fdi/fdi.dtd
===================================================================
RCS file: /cvs/hal/hal/fdi/fdi.dtd,v
retrieving revision 1.1
diff -u -p -r1.1 fdi.dtd
--- hal/fdi/fdi.dtd	2 Jan 2004 12:11:24 -0000	1.1
+++ hal/fdi/fdi.dtd	9 Dec 2005 04:15:02 -0000
@@ -9,16 +9,44 @@
 
 <!ELEMENT device (match|merge)*  >
 
-<!ELEMENT match (match|merge)* >
+<!ELEMENT match (match|merge|prepend|append|remove)* >
 <!ATTLIST match 
-    key    CDATA #REQUIRED
-    string CDATA #IMPLIED
-    int    CDATA #IMPLIED
-    bool   CDATA #IMPLIED
+    key              CDATA #REQUIRED
+    string           CDATA #IMPLIED
+    int              CDATA #IMPLIED
+    bool             (false|true) #IMPLIED
+    exists           (false|true) #IMPLIED
+    empty            (false|true) #IMPLIED
+    is_ascii         (false|true) #IMPLIED
+    is_absolute_path (false|true) #IMPLIED
+    contains         CDATA #IMPLIED
+    contains_ncase   CDATA #IMPLIED
+    compare_lt       CDATA #IMPLIED
+    compare_le       CDATA #IMPLIED
+    compare_gt       CDATA #IMPLIED
+    compare_ge       CDATA #IMPLIED
 >
 
 <!ELEMENT merge (#PCDATA) >
 <!ATTLIST merge 
     key    CDATA #REQUIRED
-    type   (string|int|bool|double) #REQUIRED
+    type   (string|int|uint64|bool|double|strlist|copy_property) #REQUIRED
+>
+
+<!ELEMENT prepend (#PCDATA) >
+<!ATTLIST prepend 
+    key    CDATA #REQUIRED
+    type   (string|strlist|int|bool|double|copy_property) #REQUIRED
+>
+
+<!ELEMENT append (#PCDATA) >
+<!ATTLIST append 
+    key    CDATA #REQUIRED
+    type   (string|strlist|int|bool|double|copy_property) #REQUIRED
+>
+
+<!ELEMENT remove (#PCDATA) >
+<!ATTLIST remove
+    key    CDATA #REQUIRED
+    type   (strlist) #REQUIRED
 >
Index: hal/fdi/20freedesktop/Makefile.am
===================================================================
RCS file: /cvs/hal/hal/fdi/20freedesktop/Makefile.am,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.am
--- hal/fdi/20freedesktop/Makefile.am	16 Dec 2004 21:11:53 -0000	1.7
+++ hal/fdi/20freedesktop/Makefile.am	9 Dec 2005 04:15:02 -0000
@@ -13,5 +13,8 @@ dist_fdi20freedesktop_DATA = 		\
         usb-pda-devices.fdi             \
         usb-pda-serial.fdi
 
+check:
+	xmllint --noout --dtdvalid $(top_srcdir)/fdi/fdi.dtd $(dist_fdi_DATA)
+
 
 
Index: hal/fdi/90defaultpolicy/Makefile.am
===================================================================
RCS file: /cvs/hal/hal/fdi/90defaultpolicy/Makefile.am,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.am
--- hal/fdi/90defaultpolicy/Makefile.am	10 Feb 2005 17:03:57 -0000	1.2
+++ hal/fdi/90defaultpolicy/Makefile.am	9 Dec 2005 04:15:02 -0000
@@ -3,3 +3,7 @@ fdi90defaultpolicydir = $(datadir)/hal/f
 
 dist_fdi90defaultpolicy_DATA = storage-policy.fdi power-mgmt-policy.fdi
 
+check:
+	xmllint --noout --dtdvalid $(top_srcdir)/fdi/fdi.dtd $(dist_fdi90defaultpolicy_DATA)
+
+
Index: hal/fdi/information/10freedesktop/Makefile.am
===================================================================
RCS file: /cvs/hal/hal/fdi/information/10freedesktop/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- hal/fdi/information/10freedesktop/Makefile.am	9 Nov 2005 20:00:13 -0000	1.6
+++ hal/fdi/information/10freedesktop/Makefile.am	9 Dec 2005 04:15:02 -0000
@@ -9,6 +9,6 @@ dist_fdi_DATA = 10-usb-card-readers.fdi 
 		10-usb-pda.fdi		   \
 		10-cd-dvd-burner.fdi
 
-
-
+check:
+	xmllint --noout --dtdvalid $(top_srcdir)/fdi/fdi.dtd $(dist_fdi_DATA)
 
Index: hal/fdi/policy/10osvendor/Makefile.am
===================================================================
RCS file: /cvs/hal/hal/fdi/policy/10osvendor/Makefile.am,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.am
--- hal/fdi/policy/10osvendor/Makefile.am	3 Sep 2005 15:55:11 -0000	1.5
+++ hal/fdi/policy/10osvendor/Makefile.am	9 Dec 2005 04:15:02 -0000
@@ -15,5 +15,8 @@ if FSTAB_SYNC_ENABLED
 dist_fdi_DATA += 90-fstab-sync.fdi
 endif
 
+check:
+	xmllint --noout --dtdvalid $(top_srcdir)/fdi/fdi.dtd $(dist_fdi_DATA)
+
 clean-local :
 	rm -f *~
Index: hal/fdi/preprobe/10osvendor/Makefile.am
===================================================================
RCS file: /cvs/hal/hal/fdi/preprobe/10osvendor/Makefile.am,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.am
--- hal/fdi/preprobe/10osvendor/Makefile.am	24 Feb 2005 19:51:04 -0000	1.2
+++ hal/fdi/preprobe/10osvendor/Makefile.am	9 Dec 2005 04:15:02 -0000
@@ -3,6 +3,6 @@ fdidir = $(datadir)/hal/fdi/preprobe/10o
 
 dist_fdi_DATA = 10-ide-drives.fdi
 
-
-
+check:
+	xmllint --noout --dtdvalid $(top_srcdir)/fdi/fdi.dtd $(dist_fdi_DATA)
 


More information about the hal mailing list