[xiph-commits] r13871 - websites/validator.xspf.org

sping at svn.xiph.org sping at svn.xiph.org
Fri Sep 21 14:34:38 PDT 2007


Author: sping
Date: 2007-09-21 14:34:38 -0700 (Fri, 21 Sep 2007)
New Revision: 13871

Modified:
   websites/validator.xspf.org/check.py
Log:
Whitescape handling fixed


Modified: websites/validator.xspf.org/check.py
===================================================================
--- websites/validator.xspf.org/check.py	2007-09-21 16:51:36 UTC (rev 13870)
+++ websites/validator.xspf.org/check.py	2007-09-21 21:34:38 UTC (rev 13871)
@@ -32,6 +32,10 @@
 # -----------------------------------------------------------------------
 # 2007-09-21 -- Sebastian Pipping <webmaster at hartwork.org>
 #
+#   * Fixed: Whitespace handling fixes copied over from libSpiff
+#
+# 2007-09-21 -- Sebastian Pipping <webmaster at hartwork.org>
+#
 #   * Added: RFC 3986 URI validation
 #   * Changed: Code re-licensed under LGPLv3 (LGPL-Any before) to be
 #       able to use 4Suite's Apache-licensed URI validation code
@@ -1032,19 +1036,41 @@
             if s.strip() != "":
                 fail("No character data allowed")
 
+        elif stackTop in [TAG_PLAYLIST_INFO, TAG_PLAYLIST_LOCATION, \
+                TAG_PLAYLIST_IDENTIFIER, TAG_PLAYLIST_IMAGE, TAG_PLAYLIST_DATE, \
+                TAG_PLAYLIST_LICENSE, TAG_PLAYLIST_LINK, TAG_PLAYLIST_META]:
+            # Collapse elements
+            # NOTE: whitespace in the middle of <dateTime>,
+            # <nonNegativeInteger>, and <anyURI> is illegal anyway
+            # which is why we we only cut head and tail here
+            globals()["accum"] += s.strip()
+
         else:
             globals()["accum"] += s
 
     elif level == 3:
-        if (stackTop == TAG_PLAYLIST_TRACKLIST_TRACK):
+        if stackTop in [TAG_PLAYLIST_ATTRIBUTION_IDENTIFIER, TAG_PLAYLIST_ATTRIBUTION_LOCATION]:
+            globals()["accum"] += s.strip()
+
+        elif (stackTop == TAG_PLAYLIST_TRACKLIST_TRACK):
             if s.strip() != "":
                 fail("No character data allowed")
-
         else:
             globals()["accum"] += s
             
     elif level == 4:
-        globals()["accum"] += s
+        if stackTop in [TAG_PLAYLIST_TRACKLIST_TRACK_LOCATION, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_IDENTIFIER, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_INFO, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_IMAGE, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_TRACKNUM, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_DURATION, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_LINK, \
+                TAG_PLAYLIST_TRACKLIST_TRACK_META]:
+            globals()["accum"] += s.strip()
+
+        else:
+            globals()["accum"] += s
         
     else:
         globals()["accum"] += s



More information about the commits mailing list